OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [posix/] [src/] [cancelrun.c] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  $Id: cancelrun.c,v 1.2 2001-09-27 11:59:17 chris Exp $
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
 
23
void _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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.