source: rtems/cpukit/posix/src/testcancel.c @ f8437c8

4.104.114.95
Last change on this file since f8437c8 was f8437c8, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/04/08 at 15:23:12

Convert to "bool".

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2008.
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#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <pthread.h>
17#include <errno.h>
18
19#include <rtems/system.h>
20#include <rtems/score/chain.h>
21#include <rtems/score/isr.h>
22#include <rtems/score/thread.h>
23#include <rtems/score/wkspace.h>
24#include <rtems/posix/cancel.h>
25#include <rtems/posix/pthread.h>
26#include <rtems/posix/threadsup.h>
27
28/*PAGE
29 *
30 *  18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
31 */
32
33void pthread_testcancel( void )
34{
35  POSIX_API_Control *thread_support;
36  bool               cancel = false;
37
38  /*
39   *  Don't even think about deleting a resource from an ISR.
40   *  Besides this request is supposed to be for _Thread_Executing
41   *  and the ISR context is not a thread.
42   */
43
44  if ( _ISR_Is_in_progress() )
45    return;
46
47  thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
48
49  _Thread_Disable_dispatch();
50    if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
51         thread_support->cancelation_requested )
52      cancel = true;
53  _Thread_Enable_dispatch();
54
55  if ( cancel )
56    _POSIX_Thread_Exit( _Thread_Executing, PTHREAD_CANCELED );
57}
Note: See TracBrowser for help on using the repository browser.