source: rtems/c/src/exec/posix/src/cancelrun.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.3 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 *  POSIX_Thread_cancel_run
20 *
21 */
22
23void POSIX_Thread_cancel_run(
24  Thread_Control *the_thread
25)
26{
27  int                                old_cancel_state;
28  POSIX_Cancel_Handler_control      *handler;
29  Chain_Control                     *handler_stack;
30  POSIX_API_Control                 *thread_support;
31  ISR_Level                          level;
32 
33  thread_support = the_thread->API_Extensions[ THREAD_API_POSIX ];
34 
35  handler_stack = &thread_support->Cancellation_Handlers;
36 
37  old_cancel_state = thread_support->cancelability_state;
38
39  thread_support->cancelability_state = PTHREAD_CANCEL_DISABLE;
40
41  while ( !_Chain_Is_empty( handler_stack ) ) {
42    _ISR_Disable( level );
43      handler = (POSIX_Cancel_Handler_control *) _Chain_Tail( handler_stack );
44      _Chain_Extract_unprotected( &handler->Node );
45    _ISR_Enable( level );
46 
47    (*handler->routine)( handler->arg );
48
49    _Workspace_Free( handler );
50  }
51
52  thread_support->cancelation_requested = 0;
53
54  thread_support->cancelability_state = old_cancel_state;
55}
Note: See TracBrowser for help on using the repository browser.