source: rtems/cpukit/posix/src/cleanuppop.c @ a29d2e7

4.104.114.84.95
Last change on this file since a29d2e7 was 874297f3, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/16/04 at 10:01:03

Remove stray white spaces.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  $Id$
3 */
4
5#if HAVE_CONFIG_H
6#include "config.h"
7#endif
8
9#include <pthread.h>
10#include <errno.h>
11
12#include <rtems/system.h>
13#include <rtems/score/chain.h>
14#include <rtems/score/isr.h>
15#include <rtems/score/thread.h>
16#include <rtems/score/wkspace.h>
17#include <rtems/posix/cancel.h>
18#include <rtems/posix/pthread.h>
19#include <rtems/posix/threadsup.h>
20
21/*PAGE
22 *
23 *  18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
24 */
25
26void pthread_cleanup_pop(
27  int    execute
28)
29{
30  POSIX_Cancel_Handler_control      *handler;
31  POSIX_Cancel_Handler_control      tmp_handler;
32  Chain_Control                     *handler_stack;
33  POSIX_API_Control                 *thread_support;
34  ISR_Level                          level;
35
36  thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
37
38  handler_stack = &thread_support->Cancellation_Handlers;
39
40  _ISR_Disable( level );
41    if ( _Chain_Is_empty( handler_stack ) ) {
42      _ISR_Enable( level );
43      return;
44    }
45
46    handler = (POSIX_Cancel_Handler_control *)
47        _Chain_Tail( handler_stack )->previous;
48    _Chain_Extract_unprotected( &handler->Node );
49
50  _ISR_Enable( level );
51
52  tmp_handler = *handler;
53
54  _Thread_Disable_dispatch();
55    _Workspace_Free( handler );
56  _Thread_Enable_dispatch();
57
58  if ( execute )
59    (*tmp_handler.routine)( tmp_handler.arg );
60}
Note: See TracBrowser for help on using the repository browser.