summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spintrcritical16
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-04-24 12:02:20 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-05-19 12:00:45 +0200
commitcc366ec8c9ecaab838a745175a0d53a7a5db437e (patch)
tree330c714baf220f30a07ea57bd08c545a072a12d3 /testsuites/sptests/spintrcritical16
parentscore: More thread queue operations (diff)
downloadrtems-cc366ec8c9ecaab838a745175a0d53a7a5db437e.tar.bz2
score: New thread queue implementation
Use thread wait flags for synchronization. The enqueue operation is now part of the initial critical section. This is the key change and enables fine grained locking on SMP for objects using a thread queue like semaphores and message queues. Update #2273.
Diffstat (limited to 'testsuites/sptests/spintrcritical16')
-rw-r--r--testsuites/sptests/spintrcritical16/init.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/testsuites/sptests/spintrcritical16/init.c b/testsuites/sptests/spintrcritical16/init.c
index 08eeb8b9b4..a094b419b3 100644
--- a/testsuites/sptests/spintrcritical16/init.c
+++ b/testsuites/sptests/spintrcritical16/init.c
@@ -14,47 +14,36 @@
#include <tmacros.h>
#include <intrcritical.h>
-#include <rtems/rtems/semimpl.h>
+#include <rtems/score/threadimpl.h>
const char rtems_test_name[] = "SPINTRCRITICAL 16";
-/* forward declarations to avoid warnings */
-rtems_task Init(rtems_task_argument argument);
-rtems_timer_service_routine test_release_from_isr(rtems_id timer, void *arg);
-Thread_blocking_operation_States getState(void);
+static Thread_Control *Main_TCB;
-Thread_Control *Main_TCB;
-rtems_id Semaphore;
-volatile bool case_hit = false;
+static rtems_id Semaphore;
-Thread_blocking_operation_States getState(void)
+static bool case_hit;
+
+static bool interrupts_blocking_op(void)
{
- Objects_Locations location;
- Semaphore_Control *sem;
-
- sem = (Semaphore_Control *)_Objects_Get(
- &_Semaphore_Information, Semaphore, &location );
- if ( location != OBJECTS_LOCAL ) {
- puts( "Bad object lookup" );
- rtems_test_exit(0);
- }
- _Thread_Unnest_dispatch();
+ Thread_Wait_flags flags = _Thread_Wait_flags_get( Main_TCB );
- return sem->Core_control.semaphore.Wait_queue.sync_state;
+ return
+ flags == ( THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_INTEND_TO_BLOCK );
}
-rtems_timer_service_routine test_release_from_isr(
+static rtems_timer_service_routine test_release_from_isr(
rtems_id timer,
void *arg
)
{
- if ( getState() == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED ) {
+ if ( interrupts_blocking_op() ) {
case_hit = true;
(void) rtems_semaphore_release( Semaphore );
}
if ( Main_TCB->Wait.queue != NULL ) {
- _Thread_queue_Process_timeout( Main_TCB );
+ _Thread_Timeout( 0, Main_TCB );
}
}
@@ -70,7 +59,7 @@ static bool test_body( void *arg )
return case_hit;
}
-rtems_task Init(
+static rtems_task Init(
rtems_task_argument ignored
)
{