[rtems commit] rtems: Simplify _Event_Surrender()
Sebastian Huber
sebh at rtems.org
Mon Jan 7 14:11:45 UTC 2013
Module: rtems
Branch: master
Commit: 5f8d1c271bf27e4121b18acbbe758151ebed37a1
Changeset: http://git.rtems.org/rtems/commit/?id=5f8d1c271bf27e4121b18acbbe758151ebed37a1
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Jan 2 18:56:38 2013 +0100
rtems: Simplify _Event_Surrender()
Check for a satisfied event condition only once.
---
cpukit/rtems/src/eventsurrender.c | 42 ++++++++++++------------------------
1 files changed, 14 insertions(+), 28 deletions(-)
diff --git a/cpukit/rtems/src/eventsurrender.c b/cpukit/rtems/src/eventsurrender.c
index 6e8dbbd..bfa29c4 100644
--- a/cpukit/rtems/src/eventsurrender.c
+++ b/cpukit/rtems/src/eventsurrender.c
@@ -48,24 +48,19 @@ void _Event_Surrender(
seized_events = _Event_sets_Get( pending_events, event_condition );
- /*
- * No events were seized in this operation
- */
- if ( _Event_sets_Is_empty( seized_events ) ) {
- _ISR_Enable( level );
- return;
- }
-
- /*
- * If we are sending to the executing thread, then we have a critical
- * section issue to deal with. The entity sending to the executing thread
- * can be either the executing thread or an ISR. In case it is the
- * executing thread, then the blocking operation state is not equal to
- * THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED.
- */
- if ( _Thread_Is_executing( the_thread ) &&
- *sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED ) {
- if ( seized_events == event_condition || _Options_Is_any(option_set) ) {
+ if (
+ !_Event_sets_Is_empty( seized_events )
+ && ( seized_events == event_condition || _Options_Is_any( option_set ) )
+ ) {
+ /*
+ * If we are sending to the executing thread, then we have a critical
+ * section issue to deal with. The entity sending to the executing thread
+ * can be either the executing thread or an ISR. In case it is the
+ * executing thread, then the blocking operation state is not equal to
+ * THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED.
+ */
+ if ( _Thread_Is_executing( the_thread ) &&
+ *sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED ) {
event->pending_events = _Event_sets_Clear(
pending_events,
seized_events
@@ -73,16 +68,7 @@ void _Event_Surrender(
the_thread->Wait.count = 0;
*(rtems_event_set *)the_thread->Wait.return_argument = seized_events;
*sync_state = THREAD_BLOCKING_OPERATION_SATISFIED;
- }
- _ISR_Enable( level );
- return;
- }
-
- /*
- * Otherwise, this is a normal send to another thread
- */
- if ( _States_Are_set( the_thread->current_state, wait_state ) ) {
- if ( seized_events == event_condition || _Options_Is_any( option_set ) ) {
+ } else if ( _States_Are_set( the_thread->current_state, wait_state ) ) {
event->pending_events = _Event_sets_Clear(
pending_events,
seized_events
More information about the vc
mailing list