source: rtems/cpukit/posix/src/cleanuppush.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 1.5 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
10#if HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <pthread.h>
15#include <errno.h>
16
17#include <rtems/system.h>
18#include <rtems/score/chain.h>
19#include <rtems/score/isr.h>
20#include <rtems/score/thread.h>
21#include <rtems/score/wkspace.h>
22#include <rtems/posix/cancel.h>
23#include <rtems/posix/pthread.h>
24#include <rtems/posix/threadsup.h>
25
26/*
27 *  18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
28 */
29
30void pthread_cleanup_push(
31  void   (*routine)( void * ),
32  void    *arg
33)
34{
35  POSIX_Cancel_Handler_control      *handler;
36  Chain_Control                     *handler_stack;
37  POSIX_API_Control                 *thread_support;
38
39  /*
40   *  The POSIX standard does not address what to do when the routine
41   *  is NULL.  It also does not address what happens when we cannot
42   *  allocate memory or anything else bad happens.
43   */
44  if ( !routine )
45    return;
46
47  _Thread_Disable_dispatch();
48  handler = _Workspace_Allocate( sizeof( POSIX_Cancel_Handler_control ) );
49
50  if ( handler ) {
51    thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
52
53    handler_stack = &thread_support->Cancellation_Handlers;
54
55    handler->routine = routine;
56    handler->arg = arg;
57
58    _Chain_Append( handler_stack, &handler->Node );
59  }
60  _Thread_Enable_dispatch();
61}
Note: See TracBrowser for help on using the repository browser.