Ejemplo n.º 1
0
void pthread_testcancel( void )
{
  POSIX_API_Control *thread_support;
  Thread_Control    *executing;
  bool               cancel = false;

  /*
   *  Don't even think about deleting a resource from an ISR.
   *  Besides this request is supposed to be for _Thread_Executing
   *  and the ISR context is not a thread.
   */

  if ( _ISR_Is_in_progress() )
    return;

  _Thread_Disable_dispatch();
    executing = _Thread_Executing;
    thread_support = executing->API_Extensions[ THREAD_API_POSIX ];

    if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
         thread_support->cancelation_requested )
      cancel = true;
  _Thread_Enable_dispatch();

  if ( cancel )
    _POSIX_Thread_Exit( executing, PTHREAD_CANCELED );
}
Ejemplo n.º 2
0
void _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch(
  Thread_Control    *the_thread
)
{
  POSIX_API_Control *thread_support;

  thread_support = the_thread->API_Extensions[ THREAD_API_POSIX ];

  if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
       thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
       thread_support->cancelation_requested ) {
    _Thread_Unnest_dispatch();
    _POSIX_Thread_Exit( the_thread, PTHREAD_CANCELED );
  } else
    _Thread_Enable_dispatch();

}
Ejemplo n.º 3
0
void pthread_exit(
  void  *value_ptr
)
{
  _POSIX_Thread_Exit( _Thread_Executing, value_ptr );
}