summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/cleanuppush.c
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>2008-01-18 16:31:57 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>2008-01-18 16:31:57 +0000
commitc3925dbe923bf0944235bc2c4556955f35b0dc91 (patch)
treecebd73d709e9f2c152f42d14362923dded35f0ef /cpukit/posix/src/cleanuppush.c
parent2008-01-18 David Erickson <David.Erickson@drdc-rddc.gc.ca> (diff)
downloadrtems-c3925dbe923bf0944235bc2c4556955f35b0dc91.tar.bz2
2008-01-18 Jennifer Averett <jennifer.averett@OARcorp.com>
* posix/include/rtems/posix/timer.h, posix/src/cleanuppop.c, posix/src/cleanuppush.c, posix/src/mqueueclose.c, posix/src/timergettime.c, posix/src/timersettime.c, score/include/rtems/score/timespec.h:
Diffstat (limited to 'cpukit/posix/src/cleanuppush.c')
-rw-r--r--cpukit/posix/src/cleanuppush.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/cpukit/posix/src/cleanuppush.c b/cpukit/posix/src/cleanuppush.c
index 964b3c4933..557b3e2d62 100644
--- a/cpukit/posix/src/cleanuppush.c
+++ b/cpukit/posix/src/cleanuppush.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -39,25 +39,26 @@ void pthread_cleanup_push(
Chain_Control *handler_stack;
POSIX_API_Control *thread_support;
+ /*
+ * The POSIX standard does not address what to do when the routine
+ * is NULL. It also does not address what happens when we cannot
+ * allocate memory or anything else bad happens.
+ */
if ( !routine )
- return; /* XXX what to do really? */
+ return;
_Thread_Disable_dispatch();
handler = _Workspace_Allocate( sizeof( POSIX_Cancel_Handler_control ) );
- if ( !handler ) {
- _Thread_Enable_dispatch();
- return; /* XXX what to do really? */
- }
-
- thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+ if ( handler ) {
+ thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
- handler_stack = &thread_support->Cancellation_Handlers;
+ handler_stack = &thread_support->Cancellation_Handlers;
- handler->routine = routine;
- handler->arg = arg;
-
- _Chain_Append( handler_stack, &handler->Node );
+ handler->routine = routine;
+ handler->arg = arg;
+ _Chain_Append( handler_stack, &handler->Node );
+ }
_Thread_Enable_dispatch();
}