summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/killinfo.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-06-24 15:43:19 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-07-23 08:01:13 +0200
commitd7665823b208daefb6855591d808e1f3075cedcb (patch)
tree2080d79568c92ae40f9a49f3f82095307766cb1f /cpukit/posix/src/killinfo.c
parentscore: Introduce Thread_queue_Queue (diff)
downloadrtems-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/posix/src/killinfo.c')
-rw-r--r--cpukit/posix/src/killinfo.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/cpukit/posix/src/killinfo.c b/cpukit/posix/src/killinfo.c
index d08e68684b..a90f4b1221 100644
--- a/cpukit/posix/src/killinfo.c
+++ b/cpukit/posix/src/killinfo.c
@@ -70,11 +70,11 @@ int killinfo(
Thread_Control *the_thread;
Thread_Control *interested;
Priority_Control interested_priority;
- Chain_Control *the_chain;
Chain_Node *the_node;
siginfo_t siginfo_struct;
siginfo_t *siginfo;
POSIX_signals_Siginfo_node *psiginfo;
+ Thread_queue_Heads *heads;
/*
* Only supported for the "calling process" (i.e. this node).
@@ -140,32 +140,35 @@ int killinfo(
/* XXX violation of visibility -- need to define thread queue support */
- the_chain = &_POSIX_signals_Wait_queue.Queue.Heads.Fifo;
+ heads = _POSIX_signals_Wait_queue.Queue.heads;
+ if ( heads != NULL ) {
+ Chain_Control *the_chain = &heads->Heads.Fifo;
- for ( the_node = _Chain_First( the_chain );
- !_Chain_Is_tail( the_chain, the_node ) ;
- the_node = the_node->next ) {
+ for ( the_node = _Chain_First( the_chain );
+ !_Chain_Is_tail( the_chain, the_node ) ;
+ the_node = the_node->next ) {
- the_thread = THREAD_CHAIN_NODE_TO_THREAD( the_node );
- api = the_thread->API_Extensions[ THREAD_API_POSIX ];
+ the_thread = THREAD_CHAIN_NODE_TO_THREAD( the_node );
+ api = the_thread->API_Extensions[ THREAD_API_POSIX ];
- #if defined(DEBUG_SIGNAL_PROCESSING)
- printk( "Waiting Thread=%p option=0x%08x mask=0x%08x blocked=0x%08x\n",
- the_thread, the_thread->Wait.option, mask, api->signals_blocked);
- #endif
+ #if defined(DEBUG_SIGNAL_PROCESSING)
+ printk( "Waiting Thread=%p option=0x%08x mask=0x%08x blocked=0x%08x\n",
+ the_thread, the_thread->Wait.option, mask, api->signals_blocked);
+ #endif
- /*
- * Is this thread is actually blocked waiting for the signal?
- */
- if (the_thread->Wait.option & mask)
- goto process_it;
+ /*
+ * Is this thread is actually blocked waiting for the signal?
+ */
+ if (the_thread->Wait.option & mask)
+ goto process_it;
- /*
- * Is this thread is blocked waiting for another signal but has
- * not blocked this one?
- */
- if (~api->signals_blocked & mask)
- goto process_it;
+ /*
+ * Is this thread is blocked waiting for another signal but has
+ * not blocked this one?
+ */
+ if (~api->signals_blocked & mask)
+ goto process_it;
+ }
}
/*