summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-01-02 18:56:38 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-01-07 15:14:07 +0100
commit5f8d1c271bf27e4121b18acbbe758151ebed37a1 (patch)
treee2158874533a014d9fcdc6b7efcb75c2c846f306
parentrtems: Simplify _Event_Surrender() (diff)
downloadrtems-5f8d1c271bf27e4121b18acbbe758151ebed37a1.tar.bz2
rtems: Simplify _Event_Surrender()
Check for a satisfied event condition only once.
-rw-r--r--cpukit/rtems/src/eventsurrender.c42
1 files changed, 14 insertions, 28 deletions
diff --git a/cpukit/rtems/src/eventsurrender.c b/cpukit/rtems/src/eventsurrender.c
index 6e8dbbdbea..bfa29c425a 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