version 1.11, 2002/03/31 00:37:56
|
version 1.14, 2002/05/21 02:43:33
|
|
|
// REVIEW: Spend time getting to know this. | // REVIEW: Spend time getting to know this. |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
PEGASUS_USING_STD; |
|
| |
class PEGASUS_COMMON_LINKAGE cleanup_handler | class PEGASUS_COMMON_LINKAGE cleanup_handler |
{ | { |
|
|
delete tsd; | delete tsd; |
} | } |
| |
|
// Note: Caller must delete the thread_data object returned (if not null) |
inline void *remove_tsd(const Sint8 *key) throw(IPCException) | inline void *remove_tsd(const Sint8 *key) throw(IPCException) |
{ | { |
return(_tsd.remove((const void *)key)); | return(_tsd.remove((const void *)key)); |
|
|
} | } |
| |
// create or re-initialize tsd associated with the key | // create or re-initialize tsd associated with the key |
// if the tsd already exists, return the existing buffer |
// if the tsd already exists, delete the existing buffer |
thread_data *put_tsd(const Sint8 *key, void (*delete_func)(void *), Uint32 size, void *value) |
void put_tsd(const Sint8 *key, void (*delete_func)(void *), Uint32 size, void *value) |
throw(IPCException) | throw(IPCException) |
| |
{ | { |
PEGASUS_ASSERT(key != NULL); | PEGASUS_ASSERT(key != NULL); |
thread_data *tsd ; | thread_data *tsd ; |
tsd = _tsd.remove((const void *)key); // may throw an IPC exception | tsd = _tsd.remove((const void *)key); // may throw an IPC exception |
|
delete tsd; |
thread_data *ntsd = new thread_data(key); | thread_data *ntsd = new thread_data(key); |
ntsd->put_data(delete_func, size, value); | ntsd->put_data(delete_func, size, value); |
try { _tsd.insert_first(ntsd); } | try { _tsd.insert_first(ntsd); } |
catch(IPCException& e) { e = e; delete ntsd; throw; } | catch(IPCException& e) { e = e; delete ntsd; throw; } |
return(tsd); |
|
} | } |
inline PEGASUS_THREAD_RETURN get_exit(void) { return _exit_code; } | inline PEGASUS_THREAD_RETURN get_exit(void) { return _exit_code; } |
inline PEGASUS_THREAD_TYPE self(void) {return pegasus_thread_self(); } | inline PEGASUS_THREAD_TYPE self(void) {return pegasus_thread_self(); } |