diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-09-21 18:41:04 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-09-21 18:41:04 +0000 |
commit | 42603bdabf7157410aed140a7239e8b0ceeee507 (patch) | |
tree | 4e69a641b1c126ad07906305b7938871ee479fca /ace/OS.cpp | |
parent | 332883847c742e3ae540bed456850f140a0a1b67 (diff) | |
download | ATCD-42603bdabf7157410aed140a7239e8b0ceeee507.tar.gz |
use ACE_MT with preallocated lock code
Diffstat (limited to 'ace/OS.cpp')
-rw-r--r-- | ace/OS.cpp | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/ace/OS.cpp b/ace/OS.cpp index 7accf878556..d9cdc617739 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -1049,12 +1049,10 @@ ACE_TSS_Cleanup::exit (void * /* status */) // in an array without invoking the according destructors. { -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_Thread_Mutex *lock = + ACE_MT (ACE_Thread_Mutex *lock = ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object (ACE_Object_Manager::ACE_TSS_CLEANUP_LOCK); - ACE_GUARD (ACE_Thread_Mutex, ace_mon, *lock); -#endif /* ACE_MT_SAFE */ + ACE_GUARD (ACE_Thread_Mutex, ace_mon, *lock)); // Prevent recursive deletions @@ -1118,12 +1116,10 @@ ACE_TSS_Cleanup::exit (void * /* status */) // Acquiring ACE_TSS_Cleanup::lock_ to free TLS keys and remove // entries from ACE_TSS_Info table. { -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_Thread_Mutex *lock = + ACE_MT (ACE_Thread_Mutex *lock = ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object (ACE_Object_Manager::ACE_TSS_CLEANUP_LOCK); - ACE_GUARD (ACE_Thread_Mutex, ace_mon, *lock); -#endif /* ACE_MT_SAFE */ + ACE_GUARD (ACE_Thread_Mutex, ace_mon, *lock)); #if 0 // We shouldn't free the key and remove it from the table here @@ -1182,13 +1178,11 @@ ACE_TSS_Cleanup::instance (void) // Create and initialize thread-specific key. if (ACE_TSS_Cleanup::instance_ == 0) { -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) // Insure that we are serialized! - ACE_Thread_Mutex *lock = + ACE_MT (ACE_Thread_Mutex *lock = ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object (ACE_Object_Manager::ACE_TSS_CLEANUP_LOCK); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, 0); -#endif /* ACE_MT_SAFE */ + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, 0)); // Now, use the Double-Checked Locking pattern to make sure we // only create the ACE_TSS_Cleanup instance once. @@ -1205,12 +1199,10 @@ ACE_TSS_Cleanup::insert (ACE_thread_key_t key, void *inst) { // ACE_TRACE ("ACE_TSS_Cleanup::insert"); -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_Thread_Mutex *lock = + ACE_MT (ACE_Thread_Mutex *lock = ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object (ACE_Object_Manager::ACE_TSS_CLEANUP_LOCK); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, -1); -#endif /* ACE_MT_SAFE */ + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, -1)); return this->table_.insert (ACE_TSS_Info (key, destructor, inst)); } @@ -1219,12 +1211,10 @@ int ACE_TSS_Cleanup::remove (ACE_thread_key_t key) { // ACE_TRACE ("ACE_TSS_Cleanup::remove"); -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_Thread_Mutex *lock = + ACE_MT (ACE_Thread_Mutex *lock = ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object (ACE_Object_Manager::ACE_TSS_CLEANUP_LOCK); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, -1); -#endif /* ACE_MT_SAFE */ + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, -1)); return this->table_.remove (ACE_TSS_Info (key)); } @@ -1232,12 +1222,10 @@ ACE_TSS_Cleanup::remove (ACE_thread_key_t key) int ACE_TSS_Cleanup::detach (void *inst) { -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_Thread_Mutex *lock = + ACE_MT (ACE_Thread_Mutex *lock = ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object (ACE_Object_Manager::ACE_TSS_CLEANUP_LOCK); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, -1); -#endif /* ACE_MT_SAFE */ + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, -1)); ACE_TSS_Info *key_info = 0; int success = 0; @@ -1283,12 +1271,10 @@ ACE_TSS_Cleanup::detach (ACE_thread_key_t key, ACE_thread_t tid) int ACE_TSS_Cleanup::key_used (ACE_thread_key_t key) { -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_Thread_Mutex *lock = + ACE_MT (ACE_Thread_Mutex *lock = ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object (ACE_Object_Manager::ACE_TSS_CLEANUP_LOCK); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, -1); -#endif /* ACE_MT_SAFE */ + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, -1)); ACE_TSS_Info *key_info = 0; |