summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadq.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-04-22 11:15:46 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-05-19 12:00:45 +0200
commit383cf42217d05a9cf19c6d081d50f92b2262a308 (patch)
tree0ee3fb9e007b2028a357a14056ed4e337886313b /cpukit/score/src/threadq.c
parentscore: Add Thread_queue_Operations (diff)
downloadrtems-383cf42217d05a9cf19c6d081d50f92b2262a308.tar.bz2
score: More thread queue operations
Move thread queue discipline specific operations into Thread_queue_Operations. Use a separate node in the thread control block for the thread queue to make it independent of the scheduler data structures. Update #2273.
Diffstat (limited to '')
-rw-r--r--cpukit/score/src/threadq.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/cpukit/score/src/threadq.c b/cpukit/score/src/threadq.c
index 47c294e968..61832c19a2 100644
--- a/cpukit/score/src/threadq.c
+++ b/cpukit/score/src/threadq.c
@@ -19,9 +19,7 @@
#endif
#include <rtems/score/threadqimpl.h>
-#include <rtems/score/chainimpl.h>
#include <rtems/score/rbtreeimpl.h>
-#include <rtems/score/scheduler.h>
#include <rtems/score/threadimpl.h>
RBTree_Compare_result _Thread_queue_Compare_priority(
@@ -51,15 +49,20 @@ void _Thread_queue_Initialize(
uint32_t timeout_status
)
{
- the_thread_queue->discipline = the_discipline;
+ const Thread_queue_Operations *operations;
+
the_thread_queue->timeout_status = timeout_status;
the_thread_queue->sync_state = THREAD_BLOCKING_OPERATION_SYNCHRONIZED;
_ISR_lock_Initialize( &the_thread_queue->Lock, "Thread Queue" );
if ( the_discipline == THREAD_QUEUE_DISCIPLINE_PRIORITY ) {
- _RBTree_Initialize_empty( &the_thread_queue->Queues.Priority );
- } else { /* must be THREAD_QUEUE_DISCIPLINE_FIFO */
- _Chain_Initialize_empty( &the_thread_queue->Queues.Fifo );
+ operations = &_Thread_queue_Operations_priority;
+ } else {
+ _Assert( the_discipline == THREAD_QUEUE_DISCIPLINE_FIFO );
+ operations = &_Thread_queue_Operations_FIFO;
}
+
+ the_thread_queue->operations = operations;
+ ( *operations->initialize )( the_thread_queue );
}