diff options
author | Till Strauman <strauman@slac.stanford.edu> | 2013-12-17 17:42:53 -0600 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2014-04-11 15:40:16 -0400 |
commit | 907cfb1e2fa46fed0d0812dc4295d91bfbe01892 (patch) | |
tree | a054d6fd55fbb65da34b7990f580c9080295d157 /cpukit/posix/src/pthreadcreate.c | |
parent | rtems_cache_invalidate_multiple_instruction_lines (diff) | |
download | rtems-907cfb1e2fa46fed0d0812dc4295d91bfbe01892.tar.bz2 |
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.
Diffstat (limited to 'cpukit/posix/src/pthreadcreate.c')
-rw-r--r-- | cpukit/posix/src/pthreadcreate.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c index c5ca86d52e..054261b5ef 100644 --- a/cpukit/posix/src/pthreadcreate.c +++ b/cpukit/posix/src/pthreadcreate.c @@ -198,6 +198,8 @@ int pthread_create( */ the_thread->do_post_task_switch_extension = true; + _Thread_Disable_dispatch(); + /* * POSIX threads are allocated and started in one operation. */ @@ -217,6 +219,7 @@ int pthread_create( * thread while we are creating it. */ if ( !status ) { + _Thread_Enable_dispatch(); _POSIX_Threads_Free( the_thread ); _RTEMS_Unlock_allocator(); return EINVAL; @@ -230,6 +233,8 @@ int pthread_create( ); } + _Thread_Enable_dispatch(); + /* * Return the id and indicate we successfully created the thread */ |