diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-03-04 08:02:19 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-03-05 11:36:45 +0100 |
commit | 7d6e94b12ab94f13d3e769702d50f91be7d5884b (patch) | |
tree | 2e2db2c1bb80c1f287f2c4c25f819ffa8b958704 /testsuites/sptests/spintrcritical21 | |
parent | score: Add thread wait flags (diff) | |
download | rtems-7d6e94b12ab94f13d3e769702d50f91be7d5884b.tar.bz2 |
score: Implement fine-grained locking for events
Use the ISR lock of the thread object to protect the event state and
use the Giant lock only for the blocking operations.
Update #2273.
Diffstat (limited to 'testsuites/sptests/spintrcritical21')
-rw-r--r-- | testsuites/sptests/spintrcritical21/init.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/testsuites/sptests/spintrcritical21/init.c b/testsuites/sptests/spintrcritical21/init.c index 8b1ddcfc37..faa48f717c 100644 --- a/testsuites/sptests/spintrcritical21/init.c +++ b/testsuites/sptests/spintrcritical21/init.c @@ -18,6 +18,7 @@ #include <intrcritical.h> +#include <rtems/score/threadimpl.h> #include <rtems/rtems/eventimpl.h> const char rtems_test_name[] = "SPINTRCRITICAL 21"; @@ -34,8 +35,16 @@ static volatile bool case_hit; static rtems_id main_task; +static Thread_Control *main_thread; + static rtems_id other_task; +static bool is_case_hit( void ) +{ + return _Thread_Wait_flags_get( main_thread) + == ( THREAD_WAIT_CLASS_EVENT | THREAD_WAIT_STATE_INTEND_TO_BLOCK ); +} + static rtems_timer_service_routine test_event_from_isr( rtems_id timer, void *arg @@ -43,7 +52,7 @@ static rtems_timer_service_routine test_event_from_isr( { rtems_status_code status; - if ( _Event_Sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED ) { + if ( is_case_hit() ) { /* * This event send hits the critical section but sends to * another task so doesn't impact this critical section. @@ -84,7 +93,7 @@ static rtems_timer_service_routine test_event_with_timeout_from_isr( { rtems_status_code status; - if ( _Event_Sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED ) { + if ( is_case_hit() ) { /* * We want to catch the task while it is blocking. Otherwise * just send and make it happy. @@ -117,6 +126,7 @@ rtems_task Init( TEST_BEGIN(); main_task = rtems_task_self(); + main_thread = _Thread_Get_executing(); status = rtems_task_create( 0xa5a5a5a5, |