blob: 9e02c9237570528f4cbf5218a7d8c692a21e3aff (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/**
* @file
*
* @brief POSIX Function Evaluates Thread Cancellation and Enables Dispatch
* @ingroup POSIXAPI
*/
/*
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <pthread.h>
#include <rtems/system.h>
#include <rtems/score/thread.h>
#include <rtems/posix/cancel.h>
#include <rtems/posix/pthreadimpl.h>
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 ) {
/* FIXME: This path is broken on SMP */
_Thread_Unnest_dispatch();
/* FIXME: Cancelability state may change here */
_POSIX_Thread_Exit( the_thread, PTHREAD_CANCELED );
} else
_Objects_Put( &the_thread->Object );
}
|