From 23fec9f0e18dc4913fab818118f836af150b98f3 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 27 Mar 2014 14:16:12 +0100 Subject: 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. --- cpukit/posix/include/rtems/posix/pthreadimpl.h | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'cpukit/posix/include/rtems/posix/pthreadimpl.h') 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 @@ -67,16 +67,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. * @@ -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 ); } /* -- cgit v1.2.3