source: rtems/cpukit/posix/src/canceleval.c @ 68799a2a

4.104.115
Last change on this file since 68799a2a was 68799a2a, checked in by Joel Sherrill <joel.sherrill@…>, on 07/21/09 at 13:17:59

2009-07-21 Santosh G Vattam <vattam.santosh@…>

  • posix/Makefile.am, posix/include/rtems/posix/cancel.h, posix/src/cancel.c, posix/src/setcancelstate.c, posix/src/setcanceltype.c: Add _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch method to avoid duplication of code and ease coverage analysis.
  • posix/src/canceleval.c: New file.
  • Property mode set to 100644
File size: 911 bytes
Line 
1/*
2 *  COPYRIGHT (c) 1989-2009.
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 <rtems/system.h>
18#include <rtems/score/thread.h>
19#include <rtems/posix/cancel.h>
20#include <rtems/posix/pthread.h>
21
22void _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch(
23  POSIX_API_Control *thread_support
24)
25{
26  bool  cancel = false;
27
28  if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
29       thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
30       thread_support->cancelation_requested )
31    cancel = true;
32 
33  _Thread_Enable_dispatch();
34 
35  if ( cancel )
36    _POSIX_Thread_Exit( _Thread_Executing, PTHREAD_CANCELED );
37}
Note: See TracBrowser for help on using the repository browser.