4.104.114.84.95
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 | * 18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184 |
---|
20 | */ |
---|
21 | |
---|
22 | void pthread_cleanup_push( |
---|
23 | void (*routine)( void * ), |
---|
24 | void *arg |
---|
25 | ) |
---|
26 | { |
---|
27 | POSIX_Cancel_Handler_control *handler; |
---|
28 | Chain_Control *handler_stack; |
---|
29 | POSIX_API_Control *thread_support; |
---|
30 | |
---|
31 | if ( !routine ) |
---|
32 | return; /* XXX what to do really? */ |
---|
33 | |
---|
34 | handler = _Workspace_Allocate( sizeof( POSIX_Cancel_Handler_control ) ); |
---|
35 | |
---|
36 | if ( !handler ) |
---|
37 | return; /* XXX what to do really? */ |
---|
38 | |
---|
39 | thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ]; |
---|
40 | |
---|
41 | handler_stack = &thread_support->Cancellation_Handlers; |
---|
42 | |
---|
43 | handler->routine = routine; |
---|
44 | handler->arg = arg; |
---|
45 | |
---|
46 | _Chain_Append( handler_stack, &handler->Node ); |
---|
47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.