forked from Imagelibrary/rtems
2009-07-21 Joel Sherrill <joel.sherrill@oarcorp.com>
* posix/include/rtems/posix/cancel.h, posix/src/cancel.c, posix/src/canceleval.c, posix/src/setcancelstate.c, posix/src/setcanceltype.c: Fix a minor bug in the previous modification which resulted in psxcancel failing.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2009-07-21 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* posix/include/rtems/posix/cancel.h, posix/src/cancel.c,
|
||||
posix/src/canceleval.c, posix/src/setcancelstate.c,
|
||||
posix/src/setcanceltype.c: Fix a minor bug in the previous
|
||||
modification which resulted in psxcancel failing.
|
||||
|
||||
2009-07-21 Santosh G Vattam <vattam.santosh@gmail.com>
|
||||
|
||||
* posix/Makefile.am, posix/include/rtems/posix/cancel.h,
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/**
|
||||
* @file rtems/posix/cancel.h
|
||||
*
|
||||
* This file contains the prototypes and data types used to implement
|
||||
* POSIX thread cancelation.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -18,36 +21,41 @@
|
||||
|
||||
#include <rtems/posix/threadsup.h>
|
||||
|
||||
/**
|
||||
* This structure is used to manage the cancelation handlers.
|
||||
*/
|
||||
typedef struct {
|
||||
/** This field is the Chain Node so we can put these on lists. */
|
||||
Chain_Node Node;
|
||||
/** This field is the cancelation routine. */
|
||||
void (*routine)( void * );
|
||||
/** This field is the argument to the cancelation routine. */
|
||||
void *arg;
|
||||
} POSIX_Cancel_Handler_control;
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_cancel_run
|
||||
*
|
||||
* DESCRIPTION:
|
||||
/**
|
||||
* @brief _POSIX_Threads_cancel_run
|
||||
*
|
||||
* This support routine runs through the chain of cancel handlers that
|
||||
* have been registered and executes them.
|
||||
*
|
||||
* @param[in] the_thread is the thread whose cancelation handlers
|
||||
* should be run
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_cancel_run(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch
|
||||
/**
|
||||
* @brief _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine separates a piece of code that existed as part of
|
||||
* another routine, but had to be separated to improve coverage.
|
||||
*
|
||||
* @param[in] the_thread is the thread to evaluate canceling
|
||||
*/
|
||||
|
||||
void _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch (
|
||||
POSIX_API_Control *thread_support
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -52,7 +52,7 @@ int pthread_cancel(
|
||||
|
||||
thread_support->cancelation_requested = 1;
|
||||
|
||||
_POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( thread_support );
|
||||
_POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( the_thread );
|
||||
return 0;
|
||||
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
|
||||
@@ -20,10 +20,14 @@
|
||||
#include <rtems/posix/pthread.h>
|
||||
|
||||
void _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch(
|
||||
POSIX_API_Control *thread_support
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
bool cancel = false;
|
||||
POSIX_API_Control *thread_support;
|
||||
bool cancel;
|
||||
|
||||
cancel = false;
|
||||
thread_support = the_thread->API_Extensions[ THREAD_API_POSIX ];
|
||||
|
||||
if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
|
||||
thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
|
||||
@@ -33,5 +37,5 @@ void _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch(
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
if ( cancel )
|
||||
_POSIX_Thread_Exit( _Thread_Executing, PTHREAD_CANCELED );
|
||||
_POSIX_Thread_Exit( the_thread, PTHREAD_CANCELED );
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ int pthread_setcancelstate(
|
||||
*oldstate = thread_support->cancelability_state;
|
||||
thread_support->cancelability_state = state;
|
||||
|
||||
_POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( thread_support );
|
||||
_POSIX_Thread_Evaluate_cancellation_and_enable_dispatch(_Thread_Executing);
|
||||
|
||||
/*
|
||||
* _Thread_Enable_dispatch is invoked by above call.
|
||||
|
||||
@@ -56,7 +56,7 @@ int pthread_setcanceltype(
|
||||
*oldtype = thread_support->cancelability_type;
|
||||
thread_support->cancelability_type = type;
|
||||
|
||||
_POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( thread_support );
|
||||
_POSIX_Thread_Evaluate_cancellation_and_enable_dispatch(_Thread_Executing);
|
||||
|
||||
/*
|
||||
* _Thread_Enable_dispatch is invoked by above call.
|
||||
|
||||
Reference in New Issue
Block a user