diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-27 14:16:12 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-31 08:29:44 +0200 |
commit | 23fec9f0e18dc4913fab818118f836af150b98f3 (patch) | |
tree | 66228f23bbf654117a33e28db7a017eea21fb785 /cpukit/posix/include | |
parent | score: Use thread life protection for API mutexes (diff) | |
download | rtems-23fec9f0e18dc4913fab818118f836af150b98f3.tar.bz2 |
score: PR2152: Use allocator mutex for objects
Use allocator mutex for objects allocate/free. This prevents that the
thread dispatch latency depends on the workspace/heap fragmentation.
Diffstat (limited to 'cpukit/posix/include')
-rw-r--r-- | cpukit/posix/include/rtems/posix/pthreadimpl.h | 21 | ||||
-rw-r--r-- | cpukit/posix/include/rtems/posix/semaphoreimpl.h | 13 |
2 files changed, 8 insertions, 26 deletions
diff --git a/cpukit/posix/include/rtems/posix/pthreadimpl.h b/cpukit/posix/include/rtems/posix/pthreadimpl.h index 02d8bca0f5..d4a04e1281 100644 --- a/cpukit/posix/include/rtems/posix/pthreadimpl.h +++ b/cpukit/posix/include/rtems/posix/pthreadimpl.h @@ -68,16 +68,6 @@ extern void (*_POSIX_Threads_Initialize_user_threads_p)(void); void _POSIX_Threads_Manager_initialization(void); /** - * @brief Allocate POSIX thread control block. - * - * This function allocates a pthread control block from - * the inactive chain of free pthread control blocks. - * - * @return This method returns a newly allocated thread. - */ -RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate( void ); - -/** * @brief Copy POSIX Thread attribute structure. * * This routine copies the attr2 thread attribute structure @@ -211,15 +201,14 @@ int rtems_pthread_attribute_compare( const pthread_attr_t *attr2 ); -/* - * _POSIX_Threads_Allocate - */ - -RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate( void ) +RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate(void) { + _Objects_Allocator_lock(); + _Thread_Kill_zombies(); - return (Thread_Control *) _Objects_Allocate( &_POSIX_Threads_Information ); + return (Thread_Control *) + _Objects_Allocate_unprotected( &_POSIX_Threads_Information ); } /* diff --git a/cpukit/posix/include/rtems/posix/semaphoreimpl.h b/cpukit/posix/include/rtems/posix/semaphoreimpl.h index 7754ee9ad7..df5e5238de 100644 --- a/cpukit/posix/include/rtems/posix/semaphoreimpl.h +++ b/cpukit/posix/include/rtems/posix/semaphoreimpl.h @@ -48,20 +48,13 @@ extern const int */ void _POSIX_Semaphore_Manager_initialization(void); -/** - * @brief POSIX Semaphore Allocate - * - * This function allocates a semaphore control block from - * the inactive chain of free semaphore control blocks. - */ - -RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate( void ) +RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control * + _POSIX_Semaphore_Allocate_unprotected( void ) { return (POSIX_Semaphore_Control *) - _Objects_Allocate( &_POSIX_Semaphore_Information ); + _Objects_Allocate_unprotected( &_POSIX_Semaphore_Information ); } - /** * @brief POSIX Semaphore Free * |