diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-06-24 15:43:19 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-07-23 08:01:13 +0200 |
commit | d7665823b208daefb6855591d808e1f3075cedcb (patch) | |
tree | 2080d79568c92ae40f9a49f3f82095307766cb1f /cpukit/score/include/rtems/score/threadq.h | |
parent | score: Introduce Thread_queue_Queue (diff) | |
download | rtems-d7665823b208daefb6855591d808e1f3075cedcb.tar.bz2 |
score: Introduce Thread_queue_Heads
Move the storage for the thread queue heads to the threads. Each thread
provides a set of thread queue heads allocated from a dedicated memory
pool. In case a thread blocks on a queue, then it lends its heads to
the queue. In case the thread unblocks, then it takes a free set of
threads from the queue. Since a thread can block on at most one queue
this works. This mechanism is used in FreeBSD. The motivation for this
change is to reduce the memory demands of the synchronization objects.
On a 32-bit uni-processor configuration the Thread_queue_Control size is
now 8 bytes, compared to 64 bytes in RTEMS 4.10 (other changes reduced
the size as well).
Diffstat (limited to 'cpukit/score/include/rtems/score/threadq.h')
-rw-r--r-- | cpukit/score/include/rtems/score/threadq.h | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h index 599a81c23c..e3aee5869a 100644 --- a/cpukit/score/include/rtems/score/threadq.h +++ b/cpukit/score/include/rtems/score/threadq.h @@ -52,6 +52,14 @@ typedef struct { RBTree_Control Priority; } Heads; + Chain_Control Free_chain; + + Chain_Node Free_node; +} Thread_queue_Heads; + +typedef struct { + Thread_queue_Heads *heads; + /** * @brief Lock to protect this thread queue. * @@ -80,17 +88,6 @@ typedef void ( *Thread_queue_Priority_change_operation )( ); /** - * @brief Thread queue initialize operation. - * - * @param[in] queue The actual thread queue. - * - * @see _Thread_Wait_set_operations(). - */ -typedef void ( *Thread_queue_Initialize_operation )( - Thread_queue_Queue *queue -); - -/** * @brief Thread queue enqueue operation. * * @param[in] queue The actual thread queue. @@ -119,7 +116,7 @@ typedef void ( *Thread_queue_Extract_operation )( /** * @brief Thread queue first operation. * - * @param[in] queue The actual thread queue. + * @param[in] heads The thread queue heads. * * @retval NULL No thread is present on the thread queue. * @retval first The first thread of the thread queue according to the insert @@ -128,7 +125,7 @@ typedef void ( *Thread_queue_Extract_operation )( * @see _Thread_Wait_set_operations(). */ typedef Thread_Control *( *Thread_queue_First_operation )( - Thread_queue_Queue *queue + Thread_queue_Heads *heads ); /** @@ -150,13 +147,6 @@ typedef struct { Thread_queue_Priority_change_operation priority_change; /** - * @brief Thread queue initialize operation. - * - * Called by object initialization routines. - */ - Thread_queue_Initialize_operation initialize; - - /** * @brief Thread queue enqueue operation. * * Called by object routines to enqueue the thread. |