source: rtems/c/src/exec/posix/src/setcanceltype.c @ 811fae1

4.104.114.84.95
Last change on this file since 811fae1 was db7f70a, checked in by Joel Sherrill <joel.sherrill@…>, on 11/02/99 at 18:47:06

Split cancel.c into multiple files.

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/*
2 *  $Id$
3 */
4
5#include <pthread.h>
6#include <errno.h>
7
8#include <rtems/system.h>
9#include <rtems/score/chain.h>
10#include <rtems/score/isr.h>
11#include <rtems/score/thread.h>
12#include <rtems/score/wkspace.h>
13#include <rtems/posix/cancel.h>
14#include <rtems/posix/pthread.h>
15#include <rtems/posix/threadsup.h>
16
17/*PAGE
18 *
19 *  18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
20 */
21
22int pthread_setcanceltype(
23  int  type,
24  int *oldtype
25)
26{
27  POSIX_API_Control                 *thread_support;
28 
29  if ( !oldtype )
30    return EINVAL;
31 
32  if ( type != PTHREAD_CANCEL_DEFERRED && type != PTHREAD_CANCEL_ASYNCHRONOUS )
33    return EINVAL;
34 
35  thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
36
37  *oldtype = thread_support->cancelability_type;
38  thread_support->cancelability_type = type;
39
40  if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
41       thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
42       thread_support->cancelation_requested )
43    POSIX_Thread_cancel_run( _Thread_Executing );
44
45  return 0;
46}
Note: See TracBrowser for help on using the repository browser.