version 1.36, 2003/10/30 00:22:39
|
version 1.37, 2004/06/03 15:04:54
|
|
|
// | // |
// Modified By: Markus Mueller | // Modified By: Markus Mueller |
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) | // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
|
// Amit K Arora, IBM (amita@in.ibm.com) for PEP#101 |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#include <Pegasus/Common/DQueue.h> | #include <Pegasus/Common/DQueue.h> |
#include <Pegasus/Common/AcceptLanguages.h> // l10n | #include <Pegasus/Common/AcceptLanguages.h> // l10n |
#include <Pegasus/Common/Linkage.h> | #include <Pegasus/Common/Linkage.h> |
|
#include <Pegasus/Common/AutoPtr.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
// create and initialize a tsd | // create and initialize a tsd |
inline void create_tsd(const Sint8 *key, int size, void *buffer) throw(IPCException) | inline void create_tsd(const Sint8 *key, int size, void *buffer) throw(IPCException) |
{ | { |
thread_data *tsd = new thread_data(key, size, buffer); |
AutoPtr<thread_data> tsd(new thread_data(key, size, buffer)); |
try { _tsd.insert_first(tsd); } |
try { _tsd.insert_first(tsd.get()); } |
catch(IPCException& e) { e = e; delete tsd; throw; } |
catch(IPCException& e) { e = e; throw; } |
|
tsd.release(); |
} | } |
| |
// get the buffer associated with the key | // get the buffer associated with the key |
|
|
// delete the tsd associated with the key | // delete the tsd associated with the key |
inline void delete_tsd(const Sint8 *key) throw(IPCException) | inline void delete_tsd(const Sint8 *key) throw(IPCException) |
{ | { |
thread_data *tsd = _tsd.remove((const void *)key); |
AutoPtr<thread_data> tsd(_tsd.remove((const void *)key)); |
if(tsd != NULL) |
|
delete tsd; |
|
} | } |
| |
// Note: Caller must delete the thread_data object returned (if not null) | // Note: Caller must delete the thread_data object returned (if not null) |
|
|
return; | return; |
} | } |
| |
thread_data* tsd = _tsd.next(0); |
AutoPtr<thread_data> tsd(_tsd.next(0)); |
while(tsd) |
while(tsd.get()) |
{ | { |
_tsd.remove_no_lock(tsd); |
_tsd.remove_no_lock(tsd.get()); |
delete tsd; |
tsd.reset(_tsd.next(0)); |
tsd = _tsd.next(0); |
|
} | } |
_tsd.unlock(); | _tsd.unlock(); |
} | } |
|
|
| |
{ | { |
PEGASUS_ASSERT(key != NULL); | PEGASUS_ASSERT(key != NULL); |
thread_data *tsd ; |
AutoPtr<thread_data> tsd ; |
tsd = _tsd.remove((const void *)key); // may throw an IPC exception |
tsd.reset(_tsd.remove((const void *)key)); // may throw an IPC exception |
delete tsd; |
tsd.reset(); |
thread_data *ntsd = new thread_data(key); |
AutoPtr<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.get()); } |
catch(IPCException& e) { e = e; delete ntsd; throw; } |
catch(IPCException& e) { e = e; throw; } |
|
ntsd.release(); |
} | } |
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(); } |
|
|
| |
inline void create_tsd(const Sint8 *key ) throw(IPCException) | inline void create_tsd(const Sint8 *key ) throw(IPCException) |
{ | { |
thread_data *tsd = new thread_data(key); |
AutoPtr<thread_data> tsd(new thread_data(key)); |
try { _tsd.insert_first(tsd); } |
try { _tsd.insert_first(tsd.get()); } |
catch(IPCException& e) { e = e; delete tsd; throw; } |
catch(IPCException& e) { e = e; throw; } |
|
tsd.release(); |
} | } |
PEGASUS_THREAD_HANDLE _handle; | PEGASUS_THREAD_HANDLE _handle; |
Boolean _is_detached; | Boolean _is_detached; |