version 1.1.2.4, 2001/07/31 12:54:35
|
version 1.1.2.6, 2001/07/31 19:02:44
|
|
|
void Thread::cleanup_push( void (*routine)(void *), void *parm) throw(IPCException) | void Thread::cleanup_push( void (*routine)(void *), void *parm) throw(IPCException) |
{ | { |
cleanup_handler *cu = new cleanup_handler(routine, parm); | cleanup_handler *cu = new cleanup_handler(routine, parm); |
try { _cleanup.insert_first(cu); } |
try |
catch(IPCException& e) { delete cu; throw; } |
{ |
|
_cleanup.insert_first(cu); |
|
} |
|
catch(IPCException& e) |
|
{ |
|
delete cu; |
|
throw; |
|
} |
return; | return; |
} | } |
| |
void Thread::cleanup_pop(Boolean execute = true) throw(IPCException) |
void Thread::cleanup_pop(Boolean execute) throw(IPCException) |
{ | { |
cleanup_handler *cu ; | cleanup_handler *cu ; |
try { cu = _cleanup.remove_first() ;} |
try |
catch(IPCException& e) { assert(0); } |
{ |
|
cu = _cleanup.remove_first() ; |
|
} |
|
catch(IPCException& e) |
|
{ |
|
PEGASUS_ASSERT(0); |
|
} |
if(execute == true) | if(execute == true) |
cu->execute(); | cu->execute(); |
delete cu; | delete cu; |
|
|
void Thread::exit_self(PEGASUS_THREAD_RETURN exit_code) | void Thread::exit_self(PEGASUS_THREAD_RETURN exit_code) |
{ | { |
// execute the cleanup stack and then return | // execute the cleanup stack and then return |
while( _cleanup.count(); ) |
while( _cleanup.count() ) |
{ | { |
try { cleanup_pop(true); } |
try |
catch(IPCException& e) { PEGASUS_ASSERT(0) ; break; } |
{ |
|
cleanup_pop(true); |
|
} |
|
catch(IPCException& e) |
|
{ |
|
PEGASUS_ASSERT(0); |
|
break; |
|
} |
} | } |
_exit_code = exit_code; | _exit_code = exit_code; |
} | } |
| |
#endif | #endif |
| |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |