Ticket #1855: pr1855_411.diff
File pr1855_411.diff, 10.0 KB (added by Joel Sherrill, on 07/31/11 at 21:45:57) |
---|
-
cpukit/posix/src/psignal.c
RCS file: /usr1/CVS/rtems/cpukit/posix/src/psignal.c,v retrieving revision 1.70 diff -u -r1.70 psignal.c
112 112 POSIX_API_Control *api; 113 113 int signo; 114 114 ISR_Level level; 115 int hold_errno; 115 116 116 117 api = the_thread->API_Extensions[ THREAD_API_POSIX ]; 117 118 118 119 /* 120 * We need to ensure that if the signal handler executes a call 121 * which overwrites the unblocking status, we restore it. 122 */ 123 hold_errno = _Thread_Executing->Wait.return_code; 124 125 /* 119 126 * api may be NULL in case of a thread close in progress 120 127 */ 121 128 if ( !api ) … … 149 156 _POSIX_signals_Check_signal( api, signo, true ); 150 157 } 151 158 } 159 160 _Thread_Executing->Wait.return_code = hold_errno; 152 161 } 153 162 154 163 /* -
cpukit/posix/src/pthread.c
RCS file: /usr1/CVS/rtems/cpukit/posix/src/pthread.c,v retrieving revision 1.84 diff -u -r1.84 pthread.c
217 217 _Thread_queue_Initialize( 218 218 &api->Join_List, 219 219 THREAD_QUEUE_DISCIPLINE_FIFO, 220 STATES_WAITING_FOR_JOIN_AT_EXIT ,220 STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_INTERRUPTIBLE_BY_SIGNAL, 221 221 0 222 222 ); 223 223 -
cpukit/posix/src/pthreadjoin.c
RCS file: /usr1/CVS/rtems/cpukit/posix/src/pthreadjoin.c,v retrieving revision 1.12 diff -u -r1.12 pthreadjoin.c
1 1 /* 2 2 * 16.1.3 Wait for Thread Termination, P1003.1c/Draft 10, p. 147 3 3 * 4 * COPYRIGHT (c) 1989-20 07.4 * COPYRIGHT (c) 1989-2011. 5 5 * On-Line Applications Research Corporation (OAR). 6 6 * 7 7 * The license and distribution terms for this file may be … … 32 32 Objects_Locations location; 33 33 void *return_pointer; 34 34 35 on_EINTR: 35 36 the_thread = _Thread_Get( thread, &location ); 36 37 switch ( location ) { 37 38 … … 66 67 } 67 68 _Thread_Enable_dispatch(); 68 69 70 if ( _Thread_Executing->Wait.return_code == EINTR ) 71 goto on_EINTR; 72 69 73 if ( value_ptr ) 70 74 *value_ptr = return_pointer; 71 75 return 0; -
testsuites/psxtests/Makefile.am
RCS file: /usr1/CVS/rtems/testsuites/psxtests/Makefile.am,v retrieving revision 1.76 diff -u -r1.76 Makefile.am
17 17 psxsignal03 psxsignal04 psxsignal05 psxsignal06 \ 18 18 psxspin01 psxspin02 psxsysconf \ 19 19 psxtime psxtimer01 psxtimer02 psxualarm psxusleep psxfatal01 psxfatal02 \ 20 psxintrcritical01 psxstack01 psxstack02 20 psxintrcritical01 psxstack01 psxstack02 \ 21 psxeintr_join 21 22 endif 22 23 23 24 ## File IO tests -
testsuites/psxtests/configure.ac
RCS file: /usr1/CVS/rtems/testsuites/psxtests/configure.ac,v retrieving revision 1.84 diff -u -r1.84 configure.ac
112 112 psxcleanup01/Makefile 113 113 psxclock/Makefile 114 114 psxcond01/Makefile 115 psxeintr_join/Makefile 115 116 psxenosys/Makefile 116 117 psxfatal01/Makefile 117 118 psxfatal02/Makefile -
new file testsuites/psxtests/psxeintr_join/.cvsignore
RCS file: testsuites/psxtests/psxeintr_join/.cvsignore diff -N testsuites/psxtests/psxeintr_join/.cvsignore
- + 1 Makefile 2 Makefile.in -
new file testsuites/psxtests/psxeintr_join/Makefile.am
RCS file: testsuites/psxtests/psxeintr_join/Makefile.am diff -N testsuites/psxtests/psxeintr_join/Makefile.am
- + 1 ## 2 ## $Id: Makefile.am,v 1.1 2010/11/05 19:33:03 joel Exp $ 3 ## 4 5 rtems_tests_PROGRAMS = psxeintr_join 6 psxeintr_join_SOURCES = init.c 7 8 dist_rtems_tests_DATA = psxeintr_join.scn 9 dist_rtems_tests_DATA += psxeintr_join.doc 10 11 include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg 12 include $(top_srcdir)/../automake/compile.am 13 include $(top_srcdir)/../automake/leaf.am 14 15 AM_CPPFLAGS += -I$(top_srcdir)/include 16 AM_CPPFLAGS += -I$(top_srcdir)/../support/include 17 18 LINK_OBJS = $(psxeintr_join_OBJECTS) $(psxeintr_join_LDADD) 19 LINK_LIBS = $(psxeintr_join_LDLIBS) 20 21 psxeintr_join$(EXEEXT): $(psxeintr_join_OBJECTS) $(psxeintr_join_DEPENDENCIES) 22 @rm -f psxeintr_join$(EXEEXT) 23 $(make-exe) 24 25 include $(top_srcdir)/../automake/local.am -
new file testsuites/psxtests/psxeintr_join/init.c
RCS file: testsuites/psxtests/psxeintr_join/init.c diff -N testsuites/psxtests/psxeintr_join/init.c
- + 1 /* 2 * COPYRIGHT (c) 1989-2011. 3 * On-Line Applications Research Corporation (OAR). 4 * 5 * The license and distribution terms for this file may be 6 * found in the file LICENSE in this distribution or at 7 * http://www.rtems.com/license/LICENSE. 8 * 9 * $Id$ 10 */ 11 12 #include <stdio.h> 13 #include <signal.h> 14 #include <semaphore.h> 15 #include <pthread.h> 16 17 #include <rtems.h> 18 #include <tmacros.h> 19 #include "test_support.h" 20 21 #define SIG_SUSPEND SIGUSR1 22 #define SIG_THR_RESTART SIGUSR2 23 24 sem_t GC_suspend_ack_sem; 25 26 static void print_sig_mask( const char * str ) 27 { 28 sigset_t blocked; 29 int i; 30 int status; 31 32 status = pthread_sigmask( SIG_BLOCK, NULL, &blocked ); 33 rtems_test_assert( status == 0 ); 34 35 printf( "%s blocked:\n", str ); 36 for ( i = 1; i < NSIG; i++) { 37 if ( sigismember( &blocked, i ) ) 38 printf( "%d ", i ); 39 } 40 printf( "\n" ); 41 } 42 43 void GC_suspend_handler( int sig ) 44 { 45 puts( "run in GC_suspend_handler" ); 46 sem_post( &GC_suspend_ack_sem ); 47 } 48 49 void GC_restart_handler( int sig ) 50 { 51 puts( "run in GC_restart_handler" ); 52 } 53 54 void* run( void *arg ) 55 { 56 int status; 57 pthread_t id = *(pthread_t *)arg; 58 59 print_sig_mask( "New Thread" ); 60 61 status = pthread_kill( id, SIG_SUSPEND ); 62 rtems_test_assert( status == 0 ); 63 64 puts( "New Thread: after pthread_kill" ); 65 status = sem_wait( &GC_suspend_ack_sem ); 66 rtems_test_assert( status == 0 ); 67 68 puts( "New Thread over!" ); 69 return NULL; 70 } 71 72 void *POSIX_Init( void *arg ) 73 { 74 struct sigaction act; 75 pthread_t newThread; 76 pthread_t mainThread; 77 int status; 78 79 puts( "*** POSIX TEST PSXEINTR_JOIN ***" ); 80 status = sem_init( &GC_suspend_ack_sem, 0, 0); 81 rtems_test_assert( status == 0 ); 82 83 status = sigemptyset( &act.sa_mask ); 84 rtems_test_assert( status == 0 ); 85 86 status = sigaddset( &act.sa_mask, SIG_SUSPEND ); 87 rtems_test_assert( status == 0 ); 88 89 status = pthread_sigmask( SIG_UNBLOCK, &act.sa_mask, NULL ); 90 rtems_test_assert( status == 0 ); 91 92 act.sa_handler = GC_suspend_handler; 93 94 status = sigaction( SIG_SUSPEND, &act, NULL ); 95 rtems_test_assert( status == 0 ); 96 97 act.sa_handler = GC_restart_handler; 98 99 print_sig_mask( "Main Thread" ); 100 101 mainThread = pthread_self(); 102 status = pthread_create( &newThread, NULL, run, &mainThread ); 103 rtems_test_assert( status == 0 ); 104 105 pthread_join( newThread, NULL ); 106 puts( "Back from pthread_join" ); 107 108 puts( "*** END OF POSIX TEST PSXEINTR_JOIN ***" ); 109 rtems_test_exit( 0 ); 110 111 return NULL; 112 } 113 114 /* configuration information */ 115 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 116 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 117 118 #define CONFIGURE_POSIX_INIT_THREAD_TABLE 119 #define CONFIGURE_MAXIMUM_POSIX_THREADS 2 120 #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 1 121 122 #define CONFIGURE_INIT 123 #include <rtems/confdefs.h> 124 /* end of file */ 125 -
new file testsuites/psxtests/psxeintr_join/psxeintr_join.doc
RCS file: testsuites/psxtests/psxeintr_join/psxeintr_join.doc diff -N testsuites/psxtests/psxeintr_join/psxeintr_join.doc
- + 1 # 2 # $Id: TEST.doc,v 1.1 2010/06/21 12:37:11 joel Exp $ 3 # 4 # COPYRIGHT (c) 1989-2011. 5 # On-Line Applications Research Corporation (OAR). 6 # 7 # The license and distribution terms for this file may be 8 # found in the file LICENSE in this distribution or at 9 # http://www.rtems.com/license/LICENSE. 10 # 11 12 This file describes the directives and concepts tested by this test set. 13 14 test set name: psxeintr_join 15 16 directives: 17 18 + pthread_join 19 + pthread_kill 20 21 concepts: 22 23 + Verify that a signal sent during a blocking pthread_join() call is properly 24 processed. -
new file testsuites/psxtests/psxeintr_join/psxeintr_join.scn
RCS file: testsuites/psxtests/psxeintr_join/psxeintr_join.scn diff -N testsuites/psxtests/psxeintr_join/psxeintr_join.scn
- + 1 *** POSIX TEST PSXEINTR_JOIN *** 2 Main Thread blocked: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 27 28 29 30 31 3 New Thread blocked: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 27 28 29 30 31 4 New Thread: after pthread_kill 5 run in GC_suspend_handler 6 New Thread over! 7 Back from pthread_join 8 *** END OF POSIX TEST PSXEINTR_JOIN *** 9