5
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Establishing Cancellation Handlers |
---|
5 | * @ingroup POSIXAPI |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2008. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <pthread.h> |
---|
22 | |
---|
23 | #include <rtems/score/thread.h> |
---|
24 | #include <rtems/score/threaddispatch.h> |
---|
25 | #include <rtems/posix/threadsup.h> |
---|
26 | |
---|
27 | void _pthread_cleanup_push( |
---|
28 | struct _pthread_cleanup_context *context, |
---|
29 | void ( *routine )( void * ), |
---|
30 | void *arg |
---|
31 | ) |
---|
32 | { |
---|
33 | POSIX_API_Control *thread_support; |
---|
34 | |
---|
35 | context->_routine = routine; |
---|
36 | context->_arg = arg; |
---|
37 | |
---|
38 | /* This value is unused, just provide a deterministic value */ |
---|
39 | context->_canceltype = -1; |
---|
40 | |
---|
41 | _Thread_Disable_dispatch(); |
---|
42 | |
---|
43 | thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ]; |
---|
44 | context->_previous = thread_support->last_cleanup_context; |
---|
45 | thread_support->last_cleanup_context = context; |
---|
46 | |
---|
47 | _Thread_Enable_dispatch(); |
---|
48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.