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/src/threadrestart.c | |
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/src/threadrestart.c')
-rw-r--r-- | cpukit/score/src/threadrestart.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c index b98b6388f8..abd809de70 100644 --- a/cpukit/score/src/threadrestart.c +++ b/cpukit/score/src/threadrestart.c @@ -93,6 +93,9 @@ static void _Thread_Make_zombie( Thread_Control *the_thread ) static void _Thread_Free( Thread_Control *the_thread ) { + Thread_Information *information = (Thread_Information *) + _Objects_Get_information_id( the_thread->Object.id ); + _User_extensions_Thread_delete( the_thread ); /* @@ -112,6 +115,11 @@ static void _Thread_Free( Thread_Control *the_thread ) _Workspace_Free( the_thread->Start.fp_context ); #endif + _Freechain_Put( + &information->Free_thread_queue_heads, + the_thread->Wait.spare_heads + ); + /* * Free the rest of the memory associated with this task * and set the associated pointers to NULL for safety. @@ -124,10 +132,7 @@ static void _Thread_Free( Thread_Control *the_thread ) _ISR_lock_Destroy( &the_thread->Lock.Default ); #endif - _Objects_Free( - _Objects_Get_information_id( the_thread->Object.id ), - &the_thread->Object - ); + _Objects_Free( &information->Objects, &the_thread->Object ); } static void _Thread_Wait_for_execution_stop( Thread_Control *the_thread ) |