diff options
Diffstat (limited to '')
-rw-r--r-- | cpukit/ChangeLog | 9 | ||||
-rw-r--r-- | cpukit/posix/src/psignal.c | 9 | ||||
-rw-r--r-- | cpukit/posix/src/pthread.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/pthreadjoin.c | 6 |
4 files changed, 24 insertions, 2 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index fe937e0579..9cbde446ce 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,5 +1,14 @@ 2011-07-31 Joel Sherrill <joel.sherrilL@OARcorp.com> + PR 1855/cpukit + * posix/src/psignal.c, posix/src/pthread.c, posix/src/pthreadjoin.c: + Correct signal processing during pthread_join. We are supposed to + unblock the thread waiting on a pthread_join(), dispatch the signal + handler, account for it potentially overwriting errno, and then have + the thread return to blocking within pthread_join(). + +2011-07-31 Joel Sherrill <joel.sherrilL@OARcorp.com> + PR 1867/cpukit * posix/src/pthreadexit.c, posix/src/pthreadjoin.c: Correct implementation of pthread_exit() and pthread_join() to support the diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c index d658274de8..e0e3e86a76 100644 --- a/cpukit/posix/src/psignal.c +++ b/cpukit/posix/src/psignal.c @@ -112,10 +112,17 @@ void _POSIX_signals_Post_switch_extension( POSIX_API_Control *api; int signo; ISR_Level level; + int hold_errno; api = the_thread->API_Extensions[ THREAD_API_POSIX ]; /* + * We need to ensure that if the signal handler executes a call + * which overwrites the unblocking status, we restore it. + */ + hold_errno = _Thread_Executing->Wait.return_code; + + /* * api may be NULL in case of a thread close in progress */ if ( !api ) @@ -149,6 +156,8 @@ void _POSIX_signals_Post_switch_extension( _POSIX_signals_Check_signal( api, signo, true ); } } + + _Thread_Executing->Wait.return_code = hold_errno; } /* diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c index 3890144aa5..0212da3378 100644 --- a/cpukit/posix/src/pthread.c +++ b/cpukit/posix/src/pthread.c @@ -217,7 +217,7 @@ bool _POSIX_Threads_Create_extension( _Thread_queue_Initialize( &api->Join_List, THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_JOIN_AT_EXIT, + STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_INTERRUPTIBLE_BY_SIGNAL, 0 ); diff --git a/cpukit/posix/src/pthreadjoin.c b/cpukit/posix/src/pthreadjoin.c index 26d53285dc..0b7e103614 100644 --- a/cpukit/posix/src/pthreadjoin.c +++ b/cpukit/posix/src/pthreadjoin.c @@ -1,7 +1,7 @@ /* * 16.1.3 Wait for Thread Termination, P1003.1c/Draft 10, p. 147 * - * COPYRIGHT (c) 1989-2007. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -32,6 +32,7 @@ int pthread_join( Objects_Locations location; void *return_pointer; +on_EINTR: the_thread = _Thread_Get( thread, &location ); switch ( location ) { @@ -66,6 +67,9 @@ int pthread_join( } _Thread_Enable_dispatch(); + if ( _Thread_Executing->Wait.return_code == EINTR ) + goto on_EINTR; + if ( value_ptr ) *value_ptr = return_pointer; return 0; |