4.104.114.84.95
Last change
on this file since 64f55e7 was
2b2ab1c,
checked in by Joel Sherrill <joel.sherrill@…>, on 11/03/99 at 12:51:09
|
Renamed POSIX_Thread_cancel_run to _POSIX_Thread_cancel_run since RTEMS
internal symbols are supposed to have leading underscores.
|
-
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 | |
---|
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 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.