Changeset 927a0a1 in rtems
- Timestamp:
- 12/02/13 07:33:35 (10 years ago)
- Branches:
- 4.11, 5, master
- Children:
- aaaedba
- Parents:
- 8abf0062
- git-author:
- Sebastian Huber <sebastian.huber@…> (12/02/13 07:33:35)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (12/02/13 08:24:51)
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/configure.ac
r8abf0062 r927a0a1 141 141 AC_CHECK_TYPES([pthread_barrier_t]) 142 142 AC_CHECK_TYPES([pthread_spinlock_t]) 143 AC_CHECK_TYPES([struct _pthread_cleanup_context],[],[],[#include <pthread.h>]) 143 144 ]) 144 145 -
cpukit/posix/include/rtems/posix/cancel.h
r8abf0062 r927a0a1 22 22 #include <rtems/posix/threadsup.h> 23 23 24 #ifndef HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT 24 25 /** 25 26 * This structure is used to manage the cancelation handlers. … … 33 34 void *arg; 34 35 } POSIX_Cancel_Handler_control; 36 #endif /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ 35 37 36 38 /** -
cpukit/posix/include/rtems/posix/threadsup.h
r8abf0062 r927a0a1 81 81 /** This indicates if a cancelation has been requested. */ 82 82 int cancelation_requested; 83 #ifndef HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT 83 84 /** This is the set of cancelation handlers. */ 84 85 Chain_Control Cancellation_Handlers; 86 #else /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ 87 /** 88 * @brief LIFO list of cleanup contexts. 89 */ 90 struct _pthread_cleanup_context *last_cleanup_context; 91 #endif /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ 85 92 86 93 /** -
cpukit/posix/src/cancelrun.c
r8abf0062 r927a0a1 20 20 21 21 #include <pthread.h> 22 #include <errno.h>23 22 24 #include <rtems/system.h> 23 #include <rtems/score/thread.h> 24 #include <rtems/score/threaddispatch.h> 25 #include <rtems/posix/cancel.h> 26 #include <rtems/posix/threadsup.h> 27 28 #ifndef HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT 29 25 30 #include <rtems/score/chainimpl.h> 26 31 #include <rtems/score/isr.h> 27 #include <rtems/score/thread.h>28 32 #include <rtems/score/wkspace.h> 29 #include <rtems/posix/cancel.h>30 33 #include <rtems/posix/pthreadimpl.h> 31 #include <rtems/posix/threadsup.h>32 34 33 35 void _POSIX_Threads_cancel_run( … … 58 60 } 59 61 } 62 63 #else /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ 64 65 void _POSIX_Threads_cancel_run( 66 Thread_Control *the_thread 67 ) 68 { 69 struct _pthread_cleanup_context *context; 70 POSIX_API_Control *thread_support; 71 72 _Thread_Disable_dispatch(); 73 74 thread_support = the_thread->API_Extensions[ THREAD_API_POSIX ]; 75 thread_support->cancelability_state = PTHREAD_CANCEL_DISABLE; 76 77 context = thread_support->last_cleanup_context; 78 thread_support->last_cleanup_context = NULL; 79 80 _Thread_Enable_dispatch(); 81 82 while ( context != NULL ) { 83 ( *context->_routine )( context->_arg ); 84 85 context = context->_previous; 86 } 87 } 88 89 #endif /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ -
cpukit/posix/src/cleanuppop.c
r8abf0062 r927a0a1 20 20 21 21 #include <pthread.h> 22 #include <errno.h>23 22 24 #include <rtems/system.h> 23 #include <rtems/score/thread.h> 24 #include <rtems/score/threaddispatch.h> 25 #include <rtems/posix/threadsup.h> 26 27 #ifndef HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT 28 25 29 #include <rtems/score/chainimpl.h> 26 30 #include <rtems/score/isr.h> 27 #include <rtems/score/thread.h>28 31 #include <rtems/score/wkspace.h> 29 32 #include <rtems/posix/cancel.h> 30 33 #include <rtems/posix/pthreadimpl.h> 31 #include <rtems/posix/threadsup.h>32 34 33 35 /* … … 80 82 (*tmp_handler.routine)( tmp_handler.arg ); 81 83 } 84 85 #else /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ 86 87 void _pthread_cleanup_pop( 88 struct _pthread_cleanup_context *context, 89 int execute 90 ) 91 { 92 POSIX_API_Control *thread_support; 93 94 if ( execute != 0 ) { 95 ( *context->_routine )( context->_arg ); 96 } 97 98 _Thread_Disable_dispatch(); 99 100 thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ]; 101 thread_support->last_cleanup_context = context->_previous; 102 103 _Thread_Enable_dispatch(); 104 } 105 106 #endif /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ -
cpukit/posix/src/cleanuppush.c
r8abf0062 r927a0a1 20 20 21 21 #include <pthread.h> 22 #include <errno.h>23 22 24 #include <rtems/system.h> 23 #include <rtems/score/thread.h> 24 #include <rtems/score/threaddispatch.h> 25 #include <rtems/posix/threadsup.h> 26 27 #ifndef HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT 28 25 29 #include <rtems/score/chainimpl.h> 26 30 #include <rtems/score/isr.h> 27 #include <rtems/score/thread.h>28 31 #include <rtems/score/wkspace.h> 29 32 #include <rtems/posix/cancel.h> 30 33 #include <rtems/posix/pthreadimpl.h> 31 #include <rtems/posix/threadsup.h>32 34 33 35 /* … … 67 69 _Thread_Enable_dispatch(); 68 70 } 71 72 #else /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ 73 74 void _pthread_cleanup_push( 75 struct _pthread_cleanup_context *context, 76 void ( *routine )( void * ), 77 void *arg 78 ) 79 { 80 POSIX_API_Control *thread_support; 81 82 context->_routine = routine; 83 context->_arg = arg; 84 85 /* This value is unused, just provide a deterministic value */ 86 context->_canceltype = -1; 87 88 _Thread_Disable_dispatch(); 89 90 thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ]; 91 context->_previous = thread_support->last_cleanup_context; 92 thread_support->last_cleanup_context = context; 93 94 _Thread_Enable_dispatch(); 95 } 96 97 #endif /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ -
cpukit/posix/src/pthread.c
r8abf0062 r927a0a1 201 201 api->cancelability_state = PTHREAD_CANCEL_ENABLE; 202 202 api->cancelability_type = PTHREAD_CANCEL_DEFERRED; 203 #ifndef HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT 203 204 _Chain_Initialize_empty (&api->Cancellation_Handlers); 205 #else /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ 206 api->last_cleanup_context = NULL; 207 #endif /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ 204 208 205 209 /* -
testsuites/psxtests/psxcleanup/psxcleanup.c
r8abf0062 r927a0a1 251 251 sleep(1); 252 252 253 /*************** ERROR CASES ***************/254 puts("Call pthread_cleanup_push with NULL handler");255 pthread_cleanup_push(NULL, NULL);256 257 puts("Call pthread_cleanup_pop with no push");258 pthread_cleanup_pop(1);259 260 253 /*************** END OF TEST *****************/ 261 254 puts( "*** END OF POSIX CLEANUP TEST ***\n" );
Note: See TracChangeset
for help on using the changeset viewer.