mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-11-16 12:34:45 +00:00
posix: fix race condition between pthread_create and capture engine
Fix PR 2068: Reproducable crashes occur when using pthreads and the capture engine at the same time. 'pthread_create()' is the culprit. It creates a SCORE thread and then calls Thread_Start( ) without disabling thread-dispatching.
This commit is contained in:
committed by
Gedare Bloom
parent
fc48ad84c7
commit
907cfb1e2f
@@ -198,6 +198,8 @@ int pthread_create(
|
|||||||
*/
|
*/
|
||||||
the_thread->do_post_task_switch_extension = true;
|
the_thread->do_post_task_switch_extension = true;
|
||||||
|
|
||||||
|
_Thread_Disable_dispatch();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* POSIX threads are allocated and started in one operation.
|
* POSIX threads are allocated and started in one operation.
|
||||||
*/
|
*/
|
||||||
@@ -217,6 +219,7 @@ int pthread_create(
|
|||||||
* thread while we are creating it.
|
* thread while we are creating it.
|
||||||
*/
|
*/
|
||||||
if ( !status ) {
|
if ( !status ) {
|
||||||
|
_Thread_Enable_dispatch();
|
||||||
_POSIX_Threads_Free( the_thread );
|
_POSIX_Threads_Free( the_thread );
|
||||||
_RTEMS_Unlock_allocator();
|
_RTEMS_Unlock_allocator();
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
@@ -230,6 +233,8 @@ int pthread_create(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Thread_Enable_dispatch();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the id and indicate we successfully created the thread
|
* Return the id and indicate we successfully created the thread
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user