Ticket #1855: pr1855_49.diff
File pr1855_49.diff, 13.7 KB (added by Joel Sherrill, on 07/31/11 at 21:46:46) |
---|
-
cpukit/posix/src/psignal.c
RCS file: /usr1/CVS/rtems/cpukit/posix/src/psignal.c,v retrieving revision 1.60 diff -u -r1.60 psignal.c
1 1 /* 2 * COPYRIGHT (c) 1989-20 07.2 * COPYRIGHT (c) 1989-2011. 3 3 * On-Line Applications Research Corporation (OAR). 4 4 * 5 5 * The license and distribution terms for this file may be … … 106 106 POSIX_API_Control *api; 107 107 int signo; 108 108 ISR_Level level; 109 int hold_errno; 110 111 /* 112 * We need to ensure that if the signal handler executes a call 113 * which overwrites the unblocking status, we restore it. 114 */ 115 hold_errno = _Thread_Executing->Wait.return_code; 109 116 110 117 api = the_thread->API_Extensions[ THREAD_API_POSIX ]; 111 118 if ( !api ) -
cpukit/posix/src/psignalunblockthread.c
RCS file: /usr1/CVS/rtems/cpukit/posix/src/psignalunblockthread.c,v retrieving revision 1.8 diff -u -r1.8 psignalunblockthread.c
1 1 /* 2 * COPYRIGHT (c) 1989-20 07.2 * COPYRIGHT (c) 1989-2011. 3 3 * On-Line Applications Research Corporation (OAR). 4 4 * 5 5 * The license and distribution terms for this file may be … … 103 103 if ( the_thread->current_state & STATES_INTERRUPTIBLE_BY_SIGNAL ) { 104 104 the_thread->Wait.return_code = EINTR; 105 105 /* 106 * At this time, there is no RTEMS API object which lets a task 107 * block on a thread queue and be interruptible by a POSIX signal. 108 * If an object class with that requirement is ever added, enable 109 * this code. 106 * In pthread_cond_wait, a thread will be blocking on a thread 107 * queue, but is also interruptible by a POSIX signal. 110 108 */ 111 #if 0 112 if ( _States_Is_waiting_on_thread_queue(the_thread->current_state) ) 113 _Thread_queue_Extract_with_proxy( the_thread ); 114 else 115 #endif 116 if ( _States_Is_delaying(the_thread->current_state) ){ 117 if ( _Watchdog_Is_active( &the_thread->Timer ) ) 118 (void) _Watchdog_Remove( &the_thread->Timer ); 119 _Thread_Unblock( the_thread ); 120 } 109 if ( _States_Is_waiting_on_thread_queue(the_thread->current_state) ) 110 _Thread_queue_Extract_with_proxy( the_thread ); 111 else if ( _States_Is_delaying(the_thread->current_state) ){ 112 (void) _Watchdog_Remove( &the_thread->Timer ); 113 _Thread_Unblock( the_thread ); 114 } 115 121 116 } else if ( the_thread->current_state == STATES_READY ) { 122 117 if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) ) 123 118 _ISR_Signals_to_thread_executing = TRUE; -
cpukit/posix/src/pthread.c
RCS file: /usr1/CVS/rtems/cpukit/posix/src/pthread.c,v retrieving revision 1.68 diff -u -r1.68 pthread.c
185 185 _Thread_queue_Initialize( 186 186 &api->Join_List, 187 187 THREAD_QUEUE_DISCIPLINE_FIFO, 188 STATES_WAITING_FOR_JOIN_AT_EXIT ,188 STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_INTERRUPTIBLE_BY_SIGNAL, 189 189 0 190 190 ); 191 191 -
cpukit/posix/src/pthreadjoin.c
RCS file: /usr1/CVS/rtems/cpukit/posix/src/pthreadjoin.c,v retrieving revision 1.8.2.2 diff -u -r1.8.2.2 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.32.2.1 diff -u -r1.32.2.1 Makefile.am
6 6 7 7 SUBDIRS = psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \ 8 8 psx10 psx11 psx12 psx13 psx14 psx16 psxcleanup psxtime psxtimer01 \ 9 psxtimer02 psxcancel psxbarrier01 psxmsgq01 psxmsgq02 psxrwlock01 10 psxsem01 psxspin01 psxe nosys psxsignal01 psxsysconf psxualarm psxkey01\11 psx fatal01 psxfatal029 psxtimer02 psxcancel psxbarrier01 psxmsgq01 psxmsgq02 psxrwlock01 \ 10 psxsem01 psxspin01 psxeintr_join psxenosys psxsignal01 psxsysconf \ 11 psxualarm psxkey01 psxfatal01 psxfatal02 12 12 13 13 ## File IO tests 14 14 SUBDIRS += psxfile01 psxreaddir psxstat psxmount psx13 psxchroot01 -
testsuites/psxtests/configure.ac
RCS file: /usr1/CVS/rtems/testsuites/psxtests/configure.ac,v retrieving revision 1.31.2.1 diff -u -r1.31.2.1 configure.ac
46 46 psxcancel/Makefile 47 47 psxchroot01/Makefile 48 48 psxcleanup/Makefile 49 psxeintr_join/Makefile 49 50 psxenosys/Makefile 50 51 psxfatal01/Makefile 51 52 psxfatal02/Makefile -
testsuites/psxtests/psx16/Makefile.am
RCS file: /usr1/CVS/rtems/testsuites/psxtests/psx16/Attic/Makefile.am,v retrieving revision 1.1.4.2 diff -u -r1.1.4.2 Makefile.am
1 1 ## 2 ## $Id: Makefile.am,v 1. 1.4.2 2011/07/31 16:17:02 joelExp $2 ## $Id: Makefile.am,v 1.24 2006/07/11 04:50:25 ralf Exp $ 3 3 ## 4 4 5 rtems_tests_PROGRAMS = psx16 6 psx16_SOURCES = init.c 5 MANAGERS = all 6 7 rtems_tests_PROGRAMS = psx16.exe 8 psx16_exe_SOURCES = init.c 7 9 8 10 dist_rtems_tests_DATA = psx16.scn 9 dist_rtems_tests_DATA += psx16.doc10 11 11 12 include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg 12 13 include $(top_srcdir)/../automake/compile.am 13 14 include $(top_srcdir)/../automake/leaf.am 14 15 16 psx16_exe_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) 17 15 18 AM_CPPFLAGS += -I$(top_srcdir)/include 16 19 AM_CPPFLAGS += -I$(top_srcdir)/../support/include 17 20 18 LINK_OBJS = $(psx16_ OBJECTS) $(psx16_LDADD)19 LINK_LIBS = $(psx16_ LDLIBS)21 LINK_OBJS = $(psx16_exe_OBJECTS) $(psx16_exe_LDADD) 22 LINK_LIBS = $(psx16_exe_LDLIBS) 20 23 21 psx16 $(EXEEXT): $(psx16_OBJECTS) $(psx16_DEPENDENCIES)22 @rm -f psx16 $(EXEEXT)24 psx16.exe$(EXEEXT): $(psx16_exe_OBJECTS) $(psx16_exe_DEPENDENCIES) 25 @rm -f psx16.exe$(EXEEXT) 23 26 $(make-exe) 24 27 25 28 include $(top_srcdir)/../automake/local.am -
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.24 2006/07/11 04:50:25 ralf Exp $ 3 ## 4 5 MANAGERS = all 6 7 rtems_tests_PROGRAMS = psxeintr_join.exe 8 psxeintr_join_exe_SOURCES = init.c 9 10 dist_rtems_tests_DATA = psxeintr_join.scn 11 12 include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg 13 include $(top_srcdir)/../automake/compile.am 14 include $(top_srcdir)/../automake/leaf.am 15 16 psxeintr_join_exe_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) 17 18 AM_CPPFLAGS += -I$(top_srcdir)/include 19 AM_CPPFLAGS += -I$(top_srcdir)/../support/include 20 21 LINK_OBJS = $(psxeintr_join_exe_OBJECTS) $(psxeintr_join_exe_LDADD) 22 LINK_LIBS = $(psxeintr_join_exe_LDLIBS) 23 24 psxeintr_join.exe$(EXEEXT): $(psxeintr_join_exe_OBJECTS) $(psxeintr_join_exe_DEPENDENCIES) 25 @rm -f psxeintr_join.exe$(EXEEXT) 26 $(make-exe) 27 28 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