diff options
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 19 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 19 | ||||
-rw-r--r-- | ace/Local_Tokens.cpp | 4 | ||||
-rw-r--r-- | ace/Local_Tokens.h | 5 | ||||
-rw-r--r-- | ace/Local_Tokens.i | 5 | ||||
-rw-r--r-- | ace/Object_Manager.cpp | 8 | ||||
-rw-r--r-- | ace/Remote_Tokens.cpp | 4 | ||||
-rw-r--r-- | ace/Remote_Tokens.h | 5 | ||||
-rw-r--r-- | ace/Remote_Tokens.i | 4 | ||||
-rw-r--r-- | ace/Token_Collection.cpp | 5 | ||||
-rw-r--r-- | ace/Token_Collection.h | 5 | ||||
-rw-r--r-- | ace/Token_Collection.i | 4 | ||||
-rw-r--r-- | ace/Token_Invariants.cpp | 5 | ||||
-rw-r--r-- | ace/Token_Invariants.h | 5 | ||||
-rw-r--r-- | ace/Token_Manager.cpp | 5 | ||||
-rw-r--r-- | ace/Token_Manager.h | 5 | ||||
-rw-r--r-- | ace/Token_Manager.i | 3 | ||||
-rw-r--r-- | ace/Token_Request_Reply.cpp | 5 | ||||
-rw-r--r-- | ace/Token_Request_Reply.h | 4 | ||||
-rw-r--r-- | ace/Token_Request_Reply.i | 3 | ||||
-rw-r--r-- | tests/Tokens_Test.cpp | 122 |
22 files changed, 210 insertions, 53 deletions
diff --git a/ChangeLog b/ChangeLog index 46626ba9956..6489eeab302 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Sun Feb 18 09:59:18 2001 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> + + * ace/Object_Manager.cpp: Added a check for ACE_HAS_TOKENS_LIBRARY + so we can skip initializing certain things if that macro is + undefined. + + * ace/Token_Collection.*: + * ace/Token_Invariants.*: + * ace/Token_Manager.*: + * ace/Local_Tokens.*: + * ace/Remote_Tokens.*: + * ace/Token_Request_Reply.*: + Only compile these files if ACE_HAS_TOKENS_LIBRARY is enabled + since this functionality does not appear to be widely used and + yet it takes up space. + + * tests/Tokens_Test.cpp (main): Only run this test if + ACE_HAS_TOKENS_LIBRARY is defined. + Sat Feb 17 17:23:46 2001 Darrell Brunsch <brunsch@uci.edu> * ace/SOCK_Dgram_Mcast.cpp: diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 46626ba9956..6489eeab302 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,22 @@ +Sun Feb 18 09:59:18 2001 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> + + * ace/Object_Manager.cpp: Added a check for ACE_HAS_TOKENS_LIBRARY + so we can skip initializing certain things if that macro is + undefined. + + * ace/Token_Collection.*: + * ace/Token_Invariants.*: + * ace/Token_Manager.*: + * ace/Local_Tokens.*: + * ace/Remote_Tokens.*: + * ace/Token_Request_Reply.*: + Only compile these files if ACE_HAS_TOKENS_LIBRARY is enabled + since this functionality does not appear to be widely used and + yet it takes up space. + + * tests/Tokens_Test.cpp (main): Only run this test if + ACE_HAS_TOKENS_LIBRARY is defined. + Sat Feb 17 17:23:46 2001 Darrell Brunsch <brunsch@uci.edu> * ace/SOCK_Dgram_Mcast.cpp: diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 46626ba9956..6489eeab302 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,22 @@ +Sun Feb 18 09:59:18 2001 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> + + * ace/Object_Manager.cpp: Added a check for ACE_HAS_TOKENS_LIBRARY + so we can skip initializing certain things if that macro is + undefined. + + * ace/Token_Collection.*: + * ace/Token_Invariants.*: + * ace/Token_Manager.*: + * ace/Local_Tokens.*: + * ace/Remote_Tokens.*: + * ace/Token_Request_Reply.*: + Only compile these files if ACE_HAS_TOKENS_LIBRARY is enabled + since this functionality does not appear to be widely used and + yet it takes up space. + + * tests/Tokens_Test.cpp (main): Only run this test if + ACE_HAS_TOKENS_LIBRARY is defined. + Sat Feb 17 17:23:46 2001 Darrell Brunsch <brunsch@uci.edu> * ace/SOCK_Dgram_Mcast.cpp: diff --git a/ace/Local_Tokens.cpp b/ace/Local_Tokens.cpp index 6edb9684175..8e4a3d55038 100644 --- a/ace/Local_Tokens.cpp +++ b/ace/Local_Tokens.cpp @@ -8,6 +8,8 @@ #include "ace/Local_Tokens.i" #endif /* __ACE_INLINE__ */ +#if defined (ACE_HAS_TOKENS_LIBRARY) + ACE_RCSID(ace, Local_Tokens, "$Id$") void @@ -1452,3 +1454,5 @@ template class ACE_Node <ACE_TPQ_Entry *>; #pragma instantiate ACE_Unbounded_Stack <ACE_TPQ_Entry *> #pragma instantiate ACE_Node <ACE_TPQ_Entry *> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Local_Tokens.h b/ace/Local_Tokens.h index b11d03f06f1..6660d8b2028 100644 --- a/ace/Local_Tokens.h +++ b/ace/Local_Tokens.h @@ -41,7 +41,6 @@ */ //============================================================================= - #ifndef ACE_LOCAL_MUTEX_H #define ACE_LOCAL_MUTEX_H #include "ace/pre.h" @@ -57,6 +56,8 @@ #include "ace/Map_Manager.h" #include "ace/Log_Msg.h" +#if defined (ACE_HAS_TOKENS_LIBRARY) + #if !(defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)) # define ACE_NO_TSS_TOKENS 1 #endif /* !(defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)) */ @@ -1088,6 +1089,8 @@ protected: ACE_Tokens *create_token (const ACE_TCHAR *name); }; +#endif /* ACE_HAS_TOKENS_LIBRARY */ + #if defined (__ACE_INLINE__) #include "ace/Local_Tokens.i" #endif /* __ACE_INLINE__ */ diff --git a/ace/Local_Tokens.i b/ace/Local_Tokens.i index 9a195950729..6f9fe43fa30 100644 --- a/ace/Local_Tokens.i +++ b/ace/Local_Tokens.i @@ -1,7 +1,7 @@ /* -*- C++ -*- */ // $Id$ -// Local_Tokens.i +#if defined (ACE_HAS_TOKENS_LIBRARY) ACE_INLINE int ACE_Token_Proxy::type (void) const @@ -10,7 +10,6 @@ ACE_Token_Proxy::type (void) const return 0; } - ACE_INLINE int ACE_Token_Proxy::acquire_read (int notify, void (*sleep_hook)(void *), @@ -431,3 +430,5 @@ ACE_Token_Name::operator== (const ACE_Token_Name &rhs) const // the name and type must be the same return (ACE_OS::strcmp (this->token_name_, rhs.name ()) == 0); } + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Object_Manager.cpp b/ace/Object_Manager.cpp index 28826755974..7b6ede3605e 100644 --- a/ace/Object_Manager.cpp +++ b/ace/Object_Manager.cpp @@ -247,12 +247,12 @@ ACE_Object_Manager::init (void) ACE_PREALLOCATE_OBJECT (ACE_Recursive_Thread_Mutex, ACE_SINGLETON_RECURSIVE_THREAD_LOCK) ACE_PREALLOCATE_OBJECT (ACE_Thread_Mutex, ACE_THREAD_EXIT_LOCK) -#if !defined (ACE_LACKS_ACE_TOKEN) +#if !defined (ACE_LACKS_ACE_TOKEN) && defined (ACE_HAS_TOKENS_LIBRARY) ACE_PREALLOCATE_OBJECT (ACE_TOKEN_CONST::MUTEX, ACE_TOKEN_MANAGER_CREATION_LOCK) ACE_PREALLOCATE_OBJECT (ACE_TOKEN_CONST::MUTEX, ACE_TOKEN_INVARIANTS_CREATION_LOCK) -#endif /* ! ACE_LACKS_ACE_TOKEN */ +#endif /* ! ACE_LACKS_ACE_TOKEN && ACE_HAS_TOKENS_LIBRARY */ ACE_PREALLOCATE_OBJECT (ACE_Thread_Mutex, ACE_PROACTOR_EVENT_LOOP_LOCK) # endif /* ACE_MT_SAFE */ @@ -707,12 +707,12 @@ ACE_Object_Manager::fini (void) ACE_DELETE_PREALLOCATED_OBJECT (ACE_Recursive_Thread_Mutex, ACE_SINGLETON_RECURSIVE_THREAD_LOCK) ACE_DELETE_PREALLOCATED_OBJECT (ACE_Thread_Mutex, ACE_THREAD_EXIT_LOCK) -#if !defined (ACE_LACKS_ACE_TOKEN) +#if !defined (ACE_LACKS_ACE_TOKEN) && defined (ACE_HAS_TOKENS_LIBRARY) ACE_DELETE_PREALLOCATED_OBJECT (ACE_TOKEN_CONST::MUTEX, ACE_TOKEN_MANAGER_CREATION_LOCK) ACE_DELETE_PREALLOCATED_OBJECT (ACE_TOKEN_CONST::MUTEX, ACE_TOKEN_INVARIANTS_CREATION_LOCK) -#endif /* ! ACE_LACKS_ACE_TOKEN */ +#endif /* ! ACE_LACKS_ACE_TOKEN && ACE_HAS_TOKENS_LIBRARY */ ACE_DELETE_PREALLOCATED_OBJECT (ACE_Thread_Mutex, ACE_PROACTOR_EVENT_LOOP_LOCK) # endif /* ACE_MT_SAFE */ diff --git a/ace/Remote_Tokens.cpp b/ace/Remote_Tokens.cpp index 504b6319e65..f8899f63c35 100644 --- a/ace/Remote_Tokens.cpp +++ b/ace/Remote_Tokens.cpp @@ -8,6 +8,8 @@ #include "ace/Remote_Tokens.i" #endif /* __ACE_INLINE__ */ +#if defined (ACE_HAS_TOKENS_LIBRARY) + ACE_RCSID(ace, Remote_Tokens, "$Id$") #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) @@ -432,3 +434,5 @@ template class ACE_Singleton <ACE_TSS_Connection, ACE_TSS_CONNECTION_MUTEX>; #pragma instantiate ACE_TSS <ACE_SOCK_Stream> #pragma instantiate ACE_Singleton <ACE_TSS_Connection, ACE_TSS_CONNECTION_MUTEX> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Remote_Tokens.h b/ace/Remote_Tokens.h index 54c486d4723..6ec934027cb 100644 --- a/ace/Remote_Tokens.h +++ b/ace/Remote_Tokens.h @@ -11,7 +11,6 @@ */ //============================================================================= - #ifndef ACE_REMOTE_MUTEX_H #define ACE_REMOTE_MUTEX_H #include "ace/pre.h" @@ -28,6 +27,8 @@ #include "ace/Local_Tokens.h" #include "ace/Token_Request_Reply.h" +#if defined (ACE_HAS_TOKENS_LIBRARY) + /** * @class ACE_Remote_Token_Proxy * @@ -305,6 +306,8 @@ private: void operator= (const ACE_TSS_Connection &); }; +#endif /* ACE_HAS_TOKENS_LIBRARY */ + #if defined (__ACE_INLINE__) #include "ace/Remote_Tokens.i" #endif /* __ACE_INLINE__ */ diff --git a/ace/Remote_Tokens.i b/ace/Remote_Tokens.i index bbd2b2613e7..01fee89af45 100644 --- a/ace/Remote_Tokens.i +++ b/ace/Remote_Tokens.i @@ -1,7 +1,7 @@ /* -*- C++ -*- */ // $Id$ -// Remote_Tokens.i +#if defined (ACE_HAS_TOKENS_LIBRARY) ACE_INLINE ACE_Remote_Mutex::ACE_Remote_Mutex (void) @@ -94,3 +94,5 @@ ACE_Remote_WLock::clone (void) const ignore_deadlock_, debug_); } + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Collection.cpp b/ace/Token_Collection.cpp index e94426b0144..a899c5e38bc 100644 --- a/ace/Token_Collection.cpp +++ b/ace/Token_Collection.cpp @@ -1,4 +1,3 @@ -// Token_Collection.cpp // $Id$ #include "ace/Token_Collection.h" @@ -7,6 +6,8 @@ #include "ace/Token_Collection.i" #endif /* __ACE_INLINE__ */ +#if defined (ACE_HAS_TOKENS_LIBRARY) + ACE_RCSID(ace, Token_Collection, "$Id$") ACE_Token_Collection::ACE_Token_Collection (int debug, @@ -300,3 +301,5 @@ template class ACE_Map_Entry<ACE_Token_Name, ACE_Token_Proxy *>; #pragma instantiate ACE_Map_Reverse_Iterator<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex> #pragma instantiate ACE_Map_Entry<ACE_Token_Name, ACE_Token_Proxy *> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Collection.h b/ace/Token_Collection.h index c0fc0bbc531..3c6e4297214 100644 --- a/ace/Token_Collection.h +++ b/ace/Token_Collection.h @@ -20,7 +20,6 @@ */ //============================================================================= - #ifndef ACE_TOKEN_COLLECTION_H #define ACE_TOKEN_COLLECTION_H #include "ace/pre.h" @@ -34,6 +33,8 @@ #include "ace/Local_Tokens.h" #include "ace/SString.h" +#if defined (ACE_HAS_TOKENS_LIBRARY) + /** * @class ACE_Token_Collection * @@ -223,6 +224,8 @@ protected: virtual ACE_Tokens *create_token (const ACE_TCHAR *name); }; +#endif /* ACE_HAS_TOKENS_LIBRARY */ + #if defined (__ACE_INLINE__) #include "ace/Token_Collection.i" #endif /* __ACE_INLINE__ */ diff --git a/ace/Token_Collection.i b/ace/Token_Collection.i index e5f83852713..fcab4df9b09 100644 --- a/ace/Token_Collection.i +++ b/ace/Token_Collection.i @@ -1,10 +1,12 @@ /* -*- C++ -*- */ // $Id$ -// Token_Collection.i +#if defined (ACE_HAS_TOKENS_LIBRARY) ACE_INLINE const ACE_TCHAR * ACE_Token_Collection::name (void) const { return name_; } + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Invariants.cpp b/ace/Token_Invariants.cpp index 7ad59665b0e..e709e1ea65b 100644 --- a/ace/Token_Invariants.cpp +++ b/ace/Token_Invariants.cpp @@ -1,9 +1,10 @@ -// Token_Invariants.cpp // $Id$ #include "ace/Token_Invariants.h" #include "ace/Object_Manager.h" +#if defined (ACE_HAS_TOKENS_LIBRARY) + ACE_RCSID(ace, Token_Invariants, "$Id$") ACE_Token_Invariant_Manager *ACE_Token_Invariant_Manager::instance_ = 0; @@ -363,3 +364,5 @@ template class ACE_Map_Entry<ACE_Token_Name, ACE_RWLock_Invariants *>; #pragma instantiate ACE_Map_Reverse_Iterator<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex> #pragma instantiate ACE_Map_Entry<ACE_Token_Name, ACE_RWLock_Invariants *> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Invariants.h b/ace/Token_Invariants.h index 2be2d194017..e5c10ebaed6 100644 --- a/ace/Token_Invariants.h +++ b/ace/Token_Invariants.h @@ -16,7 +16,6 @@ */ //============================================================================= - #ifndef ACE_TOKEN_INVARIANTS_H #define ACE_TOKEN_INVARIANTS_H #include "ace/pre.h" @@ -30,6 +29,8 @@ #include "ace/Map_Manager.h" #include "ace/Local_Tokens.h" +#if defined (ACE_HAS_TOKENS_LIBRARY) + /** * @class ACE_Mutex_Invariants * @@ -221,5 +222,7 @@ protected: static ACE_Token_Invariant_Manager *instance_; }; +#endif /* ACE_HAS_TOKENS_LIBRARY */ + #include "ace/post.h" #endif /* ACE_TOKEN_INVARIANTS_H */ diff --git a/ace/Token_Manager.cpp b/ace/Token_Manager.cpp index 8ce44b15042..055e69a2f14 100644 --- a/ace/Token_Manager.cpp +++ b/ace/Token_Manager.cpp @@ -1,4 +1,3 @@ -// Token_Manager.cpp // $Id$ #include "ace/Token_Manager.h" @@ -8,6 +7,8 @@ #include "ace/Token_Manager.i" #endif /* __ACE_INLINE__ */ +#if defined (ACE_HAS_TOKENS_LIBRARY) + ACE_RCSID(ace, Token_Manager, "$Id$") // singleton token manager @@ -275,3 +276,5 @@ template class ACE_Map_Entry <ACE_Token_Name, ACE_Tokens *>; #pragma instantiate ACE_Map_Reverse_Iterator<ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex> #pragma instantiate ACE_Map_Entry <ACE_Token_Name, ACE_Tokens *> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Manager.h b/ace/Token_Manager.h index 56fb63db6a0..aec44e08ae3 100644 --- a/ace/Token_Manager.h +++ b/ace/Token_Manager.h @@ -10,7 +10,6 @@ */ //============================================================================= - #ifndef ACE_TOKEN_MANAGER_H #define ACE_TOKEN_MANAGER_H #include "ace/pre.h" @@ -24,6 +23,8 @@ #include "ace/Map_Manager.h" #include "ace/Local_Tokens.h" +#if defined (ACE_HAS_TOKENS_LIBRARY) + class ACE_Local_Mutex; class ACE_Mutex_Token; @@ -124,6 +125,8 @@ private: COLLECTION collection_; }; +#endif /* ACE_HAS_TOKENS_LIBRARY */ + #if defined (__ACE_INLINE__) #include "ace/Token_Manager.i" #endif /* __ACE_INLINE__ */ diff --git a/ace/Token_Manager.i b/ace/Token_Manager.i index 572d439f289..2ef2d7e1f53 100644 --- a/ace/Token_Manager.i +++ b/ace/Token_Manager.i @@ -1,7 +1,7 @@ /* -*- C++ -*- */ // $Id$ -// Token_Manager.i +#if defined (ACE_HAS_TOKENS_LIBRARY) ACE_INLINE ACE_TOKEN_CONST::MUTEX & ACE_Token_Manager::mutex (void) @@ -17,3 +17,4 @@ ACE_Token_Manager::debug (int d) debug_ = d; } +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Request_Reply.cpp b/ace/Token_Request_Reply.cpp index dca95183e83..9fecb01e443 100644 --- a/ace/Token_Request_Reply.cpp +++ b/ace/Token_Request_Reply.cpp @@ -1,4 +1,3 @@ -// Token_Request_Reply.cpp // $Id$ #include "ace/Token_Request_Reply.h" @@ -7,6 +6,8 @@ #include "ace/Token_Request_Reply.i" #endif /* __ACE_INLINE__ */ +#if defined (ACE_HAS_TOKENS_LIBRARY) + ACE_RCSID(ace, Token_Request_Reply, "$Id$") // Default "do nothing" constructor. @@ -173,3 +174,5 @@ ACE_Token_Reply::dump (void) const this->length (), this->errnum ())); ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("arg = %d"), this->arg ())); } + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Request_Reply.h b/ace/Token_Request_Reply.h index f1f10b93ba9..1c3aa88d09c 100644 --- a/ace/Token_Request_Reply.h +++ b/ace/Token_Request_Reply.h @@ -28,6 +28,8 @@ #include "ace/Time_Value.h" +#if defined (ACE_HAS_TOKENS_LIBRARY) + // Specifies the size of the fixed length portion of // the Transfer structure in ACE_Token_Request #define ACE_TOKEN_REQUEST_HEADER_SIZE 40 @@ -235,6 +237,8 @@ private: } transfer_; }; +#endif /* ACE_HAS_TOKENS_LIBRARY */ + #if defined (__ACE_INLINE__) #include "ace/Token_Request_Reply.i" #endif /* __ACE_INLINE__ */ diff --git a/ace/Token_Request_Reply.i b/ace/Token_Request_Reply.i index 999677a664f..e1c8ace3ad5 100644 --- a/ace/Token_Request_Reply.i +++ b/ace/Token_Request_Reply.i @@ -1,7 +1,7 @@ /* -*- C++ -*- */ // $Id$ -// Token_Request_Reply.i +#if defined (ACE_HAS_TOKENS_LIBRARY) // = Set/get the length of the encoded/decoded message. @@ -193,3 +193,4 @@ ACE_Token_Reply::arg (ACE_UINT32 arg) this->transfer_.arg_ = htonl (arg); } +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/tests/Tokens_Test.cpp b/tests/Tokens_Test.cpp index 30113586aac..94cd5ff2656 100644 --- a/tests/Tokens_Test.cpp +++ b/tests/Tokens_Test.cpp @@ -36,7 +36,7 @@ ACE_RCSID(tests, Tokens_Test, "$Id$") -#if defined (ACE_HAS_THREADS) +#if defined (ACE_HAS_THREADS) && defined (ACE_HAS_TOKENS_LIBRARY) typedef ACE_Token_Invariant_Manager TOKEN_INVARIANTS; @@ -65,7 +65,8 @@ run_thread (void *vp) collection.insert (*(tp->token1_)); collection.insert (*(tp->token2_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) new thread.\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%t) new thread.\n"))); thread_start->wait (); int count = 50; @@ -75,7 +76,8 @@ run_thread (void *vp) { if (ACE_OS::last_error () == EDEADLK) { - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("deadlock detected in acquire"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("deadlock detected in acquire"))); continue; } ACE_ERROR ((LM_ERROR, @@ -87,7 +89,9 @@ run_thread (void *vp) ACE_ASSERT ((TOKEN_INVARIANTS::instance ()->acquired (tp->token1_) == 1) || (TOKEN_INVARIANTS::instance ()->acquired (tp->token2_) == 1)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) %s acquired.\n"), collection.name ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%t) %s acquired.\n"), + collection.name ())); TOKEN_INVARIANTS::instance ()->releasing (tp->token1_); TOKEN_INVARIANTS::instance ()->releasing (tp->token2_); @@ -96,10 +100,12 @@ run_thread (void *vp) { if (ACE_OS::last_error () == EDEADLK) { - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("deadlock detected"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("deadlock detected"))); goto deadlock; } - ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p renew failed\n"), + ACE_ERROR ((LM_E + RROR, ACE_TEXT ("(%t) %p renew failed\n"), ACE_TEXT ("run_thread"))); return (void *) -1; } @@ -107,7 +113,9 @@ run_thread (void *vp) ACE_ASSERT (TOKEN_INVARIANTS::instance ()->acquired (tp->token1_) == 1 || TOKEN_INVARIANTS::instance ()->acquired (tp->token2_) == 1); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) %s renewed.\n"), collection.name ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%t) %s renewed.\n"), + collection.name ())); deadlock: @@ -116,15 +124,20 @@ run_thread (void *vp) if (collection.release () == -1) { - ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p release failed\n"),ACE_TEXT ("run_thread"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%t) %p release failed\n"), + ACE_TEXT ("run_thread"))); return (void *) -1; } - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) %s released.\n"), collection.name ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%t) %s released.\n"), + collection.name ())); } - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) thread finished.\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%t) thread finished.\n"))); return 0; } @@ -156,24 +169,36 @@ run_test (ACE_Token_Proxy *A, ACE_Thread_Manager *mgr = ACE_Thread_Manager::instance (); if (mgr->spawn (ACE_THR_FUNC (run_thread), - (void *) &tp1, THR_BOUND) == -1) - ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT ("%p\n"), ACE_TEXT ("spawn 1 failed")), -1); + (void *) &tp1, + THR_BOUND) == -1) + ACE_ERROR_RETURN ((LM_DEBUG, + ACE_TEXT ("%p\n"), + ACE_TEXT ("spawn 1 failed")), + -1); if (mgr->spawn (ACE_THR_FUNC (run_thread), - (void *) &tp2, THR_BOUND) == -1) - ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT ("%p\n"), ACE_TEXT ("spawn 2 failed")), -1); + (void *) &tp2, + THR_BOUND) == -1) + ACE_ERROR_RETURN ((LM_DEBUG, + ACE_TEXT ("%p\n"), + ACE_TEXT ("spawn 2 failed")), + -1); if (mgr->spawn (ACE_THR_FUNC (run_thread), - (void *) &tp3, THR_BOUND) == -1) - ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT ("%p\n"), ACE_TEXT ("spawn 3 failed")), -1); + (void *) &tp3, + THR_BOUND) == -1) + ACE_ERROR_RETURN ((LM_DEBUG, + ACE_TEXT ("%p\n"), + ACE_TEXT ("spawn 3 failed")), -1); // Wait for all threads to exit. mgr->wait (); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test finished.\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Test finished.\n"))); return 0; } -#endif /* ACE_HAS_THREADS */ +#endif /* ACE_HAS_THREADS && ACE_HAS_TOKENS_LIBRARY */ int main (int, ACE_TCHAR *[]) @@ -182,11 +207,21 @@ main (int, ACE_TCHAR *[]) #if defined (ACE_HAS_THREADS) ACE_Token_Proxy *A = 0, *B = 0, *R = 0, *W = 0; - ACE_NEW_RETURN (A, ACE_Local_Mutex (ACE_TEXT ("L Mutex A"), 0, 0), -1); - ACE_NEW_RETURN (B, ACE_Local_Mutex (ACE_TEXT ("L Mutex B"), 0, 0), -1); - ACE_NEW_RETURN (R, ACE_Local_RLock (ACE_TEXT ("L Reader Lock"), 0, 0), -1); - ACE_NEW_RETURN (W, ACE_Local_WLock (ACE_TEXT ("L Writer Lock"), 0, 0), -1); - ACE_NEW_RETURN (thread_start, ACE_Barrier (3), -1); + ACE_NEW_RETURN (A, + ACE_Local_Mutex (ACE_TEXT ("L Mutex A"), 0, 0), + -1); + ACE_NEW_RETURN (B, + ACE_Local_Mutex (ACE_TEXT ("L Mutex B"), 0, 0), + -1); + ACE_NEW_RETURN (R, + ACE_Local_RLock (ACE_TEXT ("L Reader Lock"), 0, 0), + -1); + ACE_NEW_RETURN (W, + ACE_Local_WLock (ACE_TEXT ("L Writer Lock"), 0, 0), + -1); + ACE_NEW_RETURN (thread_start, + ACE_Barrier (3), + -1); run_test (A, B, R, W); @@ -201,16 +236,20 @@ main (int, ACE_TCHAR *[]) ACE_Process_Options options; options.command_line (cl); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Forking Token Service.\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Forking Token Service.\n"))); // Start up the token server for the remote test. ACE_Process new_process; if (new_process.spawn (options) == -1) - ACE_ERROR ((LM_DEBUG, ACE_TEXT ("%n; %p (%s), will not run remote test.\n"), - ACE_TEXT ("Server fork failed"), cl)); + ACE_ERROR ((LM_DEBUG, + ACE_TEXT ("%n; %p (%s), will not run remote test.\n"), + ACE_TEXT ("Server fork failed"), + cl)); else { - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Server forked with pid = %d.\n"), + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Server forked with pid = %d.\n"), new_process.getpid ())); // Wait for the server to start. @@ -218,7 +257,8 @@ main (int, ACE_TCHAR *[]) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Using Token Server on %s at port %d.\n"), - server_host, server_port)); + server_host, + server_port)); ACE_Remote_Mutex::set_server_address (ACE_INET_Addr (server_port, server_host)); @@ -227,10 +267,18 @@ main (int, ACE_TCHAR *[]) delete R; delete W; - ACE_NEW_RETURN (A, ACE_Remote_Mutex (ACE_TEXT ("R Mutex A"), 0, 1), -1); - ACE_NEW_RETURN (B, ACE_Remote_Mutex (ACE_TEXT ("R Mutex B"), 0, 1), -1); - ACE_NEW_RETURN (R, ACE_Remote_RLock (ACE_TEXT ("R Reader Lock"), 0, 1), -1); - ACE_NEW_RETURN (W, ACE_Remote_WLock (ACE_TEXT ("R Writer Lock"), 0, 1), -1); + ACE_NEW_RETURN (A, + ACE_Remote_Mutex (ACE_TEXT ("R Mutex A"), 0, 1), + -1); + ACE_NEW_RETURN (B, + ACE_Remote_Mutex (ACE_TEXT ("R Mutex B"), 0, 1), + -1); + ACE_NEW_RETURN (R, + ACE_Remote_RLock (ACE_TEXT ("R Reader Lock"), 0, 1), + -1); + ACE_NEW_RETURN (W, + ACE_Remote_WLock (ACE_TEXT ("R Writer Lock"), 0, 1), + -1); run_test (A, B, R, W); @@ -239,7 +287,9 @@ main (int, ACE_TCHAR *[]) // Kill the token server. if (new_process.terminate () == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Kill failed.\n")), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Kill failed.\n")), + -1); } delete thread_start; @@ -249,7 +299,11 @@ main (int, ACE_TCHAR *[]) delete R; delete W; - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) main thread exiting.\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%t) main thread exiting.\n"))); +#elif defined (ACE_HAS_TOKENS_LIBRARY) + ACE_ERROR ((LM_INFO, + ACE_TEXT ("ACE must be compiled with -DACE_HAS_TOKENS_LIBRARY to run this test\n"))); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); |