source: rtems/c/src/exec/posix/src/cleanuppop.c @ db7f70a

4.104.114.84.95
Last change on this file since db7f70a 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.1 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.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
20 */
21
22void pthread_cleanup_pop(
23  int    execute
24)
25{
26  POSIX_Cancel_Handler_control      *handler;
27  Chain_Control                     *handler_stack;
28  POSIX_API_Control                 *thread_support;
29  ISR_Level                          level;
30 
31  thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
32 
33  handler_stack = &thread_support->Cancellation_Handlers;
34
35  if ( _Chain_Is_empty( handler_stack ) )
36    return;
37 
38  _ISR_Disable( level );
39    handler = (POSIX_Cancel_Handler_control *) _Chain_Tail( handler_stack );
40    _Chain_Extract_unprotected( &handler->Node );
41  _ISR_Enable( level );
42
43  if ( execute )
44    (*handler->routine)( handler->arg );
45 
46  _Workspace_Free( handler );
47}
Note: See TracBrowser for help on using the repository browser.