diff options
-rw-r--r-- | ChangeLog-97a | 28 | ||||
-rw-r--r-- | ace/Log_Msg.cpp | 28 | ||||
-rw-r--r-- | ace/Message_Block.cpp | 75 | ||||
-rw-r--r-- | ace/Message_Block.h | 9 | ||||
-rw-r--r-- | ace/Reactor.cpp | 5 | ||||
-rw-r--r-- | ace/ReactorEx.cpp | 7 | ||||
-rw-r--r-- | ace/ReactorEx.h | 2 | ||||
-rw-r--r-- | ace/ReactorEx.i | 8 | ||||
-rw-r--r-- | ace/Service_Config.cpp | 5 | ||||
-rw-r--r-- | ace/Synch.i | 1 | ||||
-rw-r--r-- | ace/Synch_T.cpp | 8 | ||||
-rw-r--r-- | ace/Synch_T.h | 14 | ||||
-rw-r--r-- | ace/Task.h | 7 | ||||
-rw-r--r-- | examples/Reactor/Misc/notification.cpp | 50 | ||||
-rw-r--r-- | examples/Reactor/Misc/test_reactors.cpp | 4 | ||||
-rw-r--r-- | netsvcs/clients/Naming/Dump_Restore/createfile.cpp | 2 |
16 files changed, 177 insertions, 76 deletions
diff --git a/ChangeLog-97a b/ChangeLog-97a index 20b0c740146..feca8cb559a 100644 --- a/ChangeLog-97a +++ b/ChangeLog-97a @@ -1,5 +1,33 @@ Tue Jan 7 13:03:25 1997 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> + * ace/Message_Block: Added a new constructor to ACE_Message_Block + that takes an ACE_Data_Block * and "owns" it. Thanks to Tim for + this idea. + + * ace/Log_Msg.cpp: Now that we've prevented signal handlers from + occurring within critical sections of ACE_Log_Msg::log() we + don't need to use the ACE_Recursive_Thread_Mutex anymore. + Instead, we just need ACE_Thread_Mutex. + + * ace/Log_Msg.cpp (log): Added an ACE_Sig_Guard to the block in + ACE_Log_Msg::log() that acquires the mutex that serializes + output. This prevents nasty problems with recursive to + ACE_Log_Msg::log() from within signal handlers. + + * ace/Service_Config.cpp (end_reactor_event_loop): Added a timeout + of ACE_Time_Value::zero to the ACE_Reactor::notify() method when + called in the ACE_Service_Config::end_reactor_event_loop(). + This prevents the Reactor from blocking indefinitely if there's + no longer a thread to receive from the notification pipe. + + * netsvcs/clients/Naming/Dump_Restore: Removed the vestigal + nametest.cpp and nametest.h files. I'm not sure why they were + still there, but they shouldn't have been! + + * ace/Synch.i (remove): this->owner_ should be set to -1 before + calling this->release(). Thanks to Per Andersson + <Per.Andersson@hfera.ericsson.se> for suggesting this. + * ace/Thread_Manager.cpp (exit): Added a flag called "do_thr_exit" to the ACE_Thread_Control::exit() method. This controls whether we call ACE_OS::thr_exit() after removing the thread from the diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp index e7d94268c8c..0b56aff6108 100644 --- a/ace/Log_Msg.cpp +++ b/ace/Log_Msg.cpp @@ -23,6 +23,7 @@ #include "ace/Thread.h" #include "ace/Synch.h" +#include "ace/Signal.h" #if defined (ACE_HAS_UNICODE) #define ACE_WSPRINTF(BUF,VALUE) ::wsprintf (BUF, "%S", VALUE) @@ -45,7 +46,7 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Log_Msg) #if defined (ACE_MT_SAFE) // Synchronize output operations. -static ACE_Recursive_Thread_Mutex *lock_ = 0; +static ACE_Thread_Mutex *lock_ = 0; #if !defined(VXWORKS) static ACE_thread_key_t key_; @@ -84,7 +85,7 @@ ACE_Log_Msg::instance (void) { // Initialize the static recursive lock here. Note that we // can't rely on the constructor being called at this point. - ACE_NEW_RETURN_I (lock_, ACE_Recursive_Thread_Mutex, 0); + ACE_NEW_RETURN_I (lock_, ACE_Thread_Mutex, 0); once_ = 1; } @@ -124,7 +125,7 @@ ACE_Log_Msg::instance (void) { // Initialize the static recursive lock here. Note that we // can't rely on the constructor being called at this point. - ACE_NEW_RETURN_I (lock_, ACE_Recursive_Thread_Mutex, 0); + ACE_NEW_RETURN_I (lock_, ACE_Thread_Mutex, 0); if (ACE_OS::thr_keycreate (&key_, &ACE_TSS_cleanup) != 0) @@ -207,7 +208,7 @@ ACE_Log_Msg::flags (void) { ACE_TRACE ("ACE_Log_Msg::flags"); u_long result; - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *lock_, 0)); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock_, 0)); result = ACE_Log_Msg::flags_; return result; @@ -217,7 +218,7 @@ void ACE_Log_Msg::set_flags (u_long flgs) { ACE_TRACE ("ACE_Log_Msg::set_flags"); - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, *lock_)); + ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, *lock_)); ACE_SET_BITS (ACE_Log_Msg::flags_, flgs); } @@ -226,7 +227,7 @@ void ACE_Log_Msg::clr_flags (u_long flgs) { ACE_TRACE ("ACE_Log_Msg::clr_flags"); - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, *lock_)); + ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, *lock_)); ACE_CLR_BITS (ACE_Log_Msg::flags_, flgs); } @@ -302,7 +303,7 @@ ACE_Log_Msg::open (const char *prog_name, LPCTSTR logger_key) { ACE_TRACE ("ACE_Log_Msg::open"); - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock_, -1)); if (prog_name) ACE_Log_Msg::program_name_ = ACE_OS::strdup (prog_name); @@ -653,8 +654,11 @@ ACE_Log_Msg::log (const char *format_str, log_record.msg_data (this->msg ()); this->stop_tracing (); - // Make sure that the lock is help during all this. - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *lock_, -1)); + // Make this block signal safe. + ACE_Sig_Guard sb; + + // Make sure that the lock is held during all this. + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock_, -1)); if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::STDERR) && abort_prog == 0) // We'll get this further down. @@ -963,6 +967,6 @@ ACE_Log_Msg::getpid (void) const return ACE_Log_Msg::pid_; } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) -ACE_MT (template class ACE_Guard<ACE_Recursive_Thread_Mutex>); -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +// #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +// ACE_MT (template class ACE_Guard<ACE_Thread_Mutex>); +// #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ diff --git a/ace/Message_Block.cpp b/ace/Message_Block.cpp index 547d19e57f2..7229c1944d9 100644 --- a/ace/Message_Block.cpp +++ b/ace/Message_Block.cpp @@ -20,7 +20,6 @@ ACE_Message_Block::data_block (ACE_Data_Block *db) this->data_block_->release (); this->data_block_ = db; - // Should we increment the reference count of <db>? // Set the read and write pointers in the <Message_Block> to point // to the buffer in the <ACE_Data_Block>. @@ -163,8 +162,8 @@ ACE_Message_Block::size (size_t length) // ... and use them to initialize the new deltas. this->rd_ptr_ = this->data_block ()->base () + r_delta; this->wr_ptr_ = this->data_block ()->base () + w_delta; - return 0; } + return 0; } ACE_Data_Block::~ACE_Data_Block (void) @@ -206,6 +205,20 @@ ACE_Message_Block::~ACE_Message_Block (void) this->next_ = 0; } +ACE_Data_Block::ACE_Data_Block (void) + : type (ACE_Message_Block::MB_DATA), + cur_size_ (0), + max_size_ (0), + flags_ (ACE_Message_Block::DONT_DELETE), + base_ (0), + allocator_strategy_ (0), + delete_allocator_strategy_ (0), + locking_strategy_ (0), + reference_count_ (1) +{ + ACE_TRACE ("ACE_Data_Block::ACE_Data_Block"); +} + ACE_Data_Block::ACE_Data_Block (size_t size, ACE_Message_Block::ACE_Message_Type msg_type, const char *msg_data, @@ -222,7 +235,7 @@ ACE_Data_Block::ACE_Data_Block (size_t size, locking_strategy_ (locking_strategy), reference_count_ (1) { - ACE_TRACE ("ACE_Data_Block::~ACE_Data_Block"); + ACE_TRACE ("ACE_Data_Block::ACE_Data_Block"); if (this->allocator_strategy_ == 0) { @@ -243,7 +256,7 @@ ACE_Message_Block::ACE_Message_Block (const char *data, ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); if (this->init_i (size, - MB_NORMAL, + MB_DATA, 0, data, 0, @@ -258,7 +271,7 @@ ACE_Message_Block::ACE_Message_Block (void) ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); if (this->init_i (0, - MB_NORMAL, + MB_DATA, 0, 0, 0, @@ -318,7 +331,7 @@ ACE_Message_Block::init (const char *data, // Should we also initialize all the other fields, as well? return this->init_i (size, - MB_NORMAL, + MB_DATA, 0, data, 0, @@ -338,8 +351,6 @@ ACE_Message_Block::ACE_Message_Block (size_t size, { ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); - ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); - if (this->init_i (size, msg_type, msg_cont, @@ -351,6 +362,22 @@ ACE_Message_Block::ACE_Message_Block (size_t size, ACE_ERROR ((LM_ERROR, "ACE_Message_Block")); } +ACE_Message_Block::ACE_Message_Block (ACE_Data_Block *data_block) +{ + ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); + + if (this->init_i (0, + MB_NORMAL, + 0, + 0, + 0, + 0, + 0, + 0, + data_block) == -1) + ACE_ERROR ((LM_ERROR, "ACE_Message_Block")); +} + int ACE_Message_Block::init_i (size_t size, ACE_Message_Type msg_type, @@ -359,7 +386,8 @@ ACE_Message_Block::init_i (size_t size, ACE_Allocator *allocator_strategy, ACE_Lock *locking_strategy, Message_Flags flags, - u_long priority) + u_long priority, + ACE_Data_Block *db) { ACE_TRACE ("ACE_Message_Block::init_i"); @@ -368,21 +396,20 @@ ACE_Message_Block::init_i (size_t size, this->next_ = 0; this->prev_ = 0; - // Allocate the <ACE_Data_Block> portion, which is reference - // counted. - ACE_NEW_RETURN (this->data_block_, - ACE_Data_Block (size, - msg_type, - msg_data, - allocator_strategy, - locking_strategy, - flags), - -1); - - // Set the read and write pointers in the new <Message_Block> to - // point to the buffer in the <ACE_Data_Block>. - this->rd_ptr (this->data_block ()->base ()); - this->wr_ptr (this->data_block ()->base ()); + if (db == 0) + // Allocate the <ACE_Data_Block> portion, which is reference + // counted. + ACE_NEW_RETURN (db, + ACE_Data_Block (size, + msg_type, + msg_data, + allocator_strategy, + locking_strategy, + flags), + -1); + + // Reset the data_block_ pointer. + this->data_block (db); return 0; } diff --git a/ace/Message_Block.h b/ace/Message_Block.h index 1de4f7eb8d0..1c4cfb56c8e 100644 --- a/ace/Message_Block.h +++ b/ace/Message_Block.h @@ -94,6 +94,9 @@ public: ACE_Message_Block (void); // Create an empty message. + ACE_Message_Block (ACE_Data_Block *); + // Create an <ACE_Message_Block> that owns the <ACE_Data_Block> *. + ACE_Message_Block (const char *data, size_t size = 0); // Create a Message Block that assumes ownership of <data> without @@ -306,7 +309,8 @@ private: ACE_Allocator *allocator, ACE_Lock *locking_strategy, Message_Flags flags, - u_long priority); + u_long priority, + ACE_Data_Block *db = 0); // Perform the actual initialization. char *rd_ptr_; @@ -351,6 +355,9 @@ class ACE_Export ACE_Data_Block { public: // = Initialization and termination methods. + ACE_Data_Block (void); + // Default "do-nothing" constructor. + ACE_Data_Block (size_t size, ACE_Message_Block::ACE_Message_Type msg_type, const char *msg_data, diff --git a/ace/Reactor.cpp b/ace/Reactor.cpp index 332df38f492..c1a0f6721ad 100644 --- a/ace/Reactor.cpp +++ b/ace/Reactor.cpp @@ -151,12 +151,13 @@ ACE_Reactor_Handler_Repository::find (ACE_HANDLE handle, ACE_TRACE ("ACE_Reactor_Handler_Repository::find"); ACE_Event_Handler *eh = 0; + ssize_t i; // Only bother to search for the <handle> if it's in range. if (this->handle_in_range (handle)) { #if defined (ACE_WIN32) - ssize_t i = 0; + i = 0; for (; i < this->max_handlep1_; i++) if (ACE_REACTOR_HANDLE (i) == handle) @@ -165,7 +166,7 @@ ACE_Reactor_Handler_Repository::find (ACE_HANDLE handle, break; } #else - ssize_t i = handle; + i = handle; eh = ACE_REACTOR_EVENT_HANDLER (this, handle); #endif /* ACE_WIN32 */ diff --git a/ace/ReactorEx.cpp b/ace/ReactorEx.cpp index 0af89f2f745..f5f90383a2d 100644 --- a/ace/ReactorEx.cpp +++ b/ace/ReactorEx.cpp @@ -342,6 +342,7 @@ ACE_ReactorEx::wait_for_multiple_events (ACE_ReactorEx_Handle_Set &wait_set, int ACE_ReactorEx::dispatch (int wait_status, int wait_all, + ACE_Event_Handler *wait_all_callback, ACE_ReactorEx_Handle_Set &dispatch_set) { // Expire all pending timers. @@ -370,7 +371,7 @@ ACE_ReactorEx::dispatch_callbacks (ACE_Event_Handler *wait_all_callback) { if (wait_all_callback != 0) { - siginfo_t handles (this->handler_rep.handles ()); + siginfo_t handles (this->handler_rep_.handles ()); if (wait_all_callback->handle_signal (0, &handles) == -1) { @@ -383,7 +384,7 @@ ACE_ReactorEx::dispatch_callbacks (ACE_Event_Handler *wait_all_callback) { int result = 0; - for (int i = 0; i < this->max_handlep1_; i++) + for (int i = 0; i < this->handler_rep_.max_handlep1 (); i++) if (this->dispatch_handler (i) == -1) result--; @@ -453,7 +454,7 @@ ACE_ReactorEx::dispatch_handler (int index) // Dispatch the handler. if (this->handler_rep_.find (index)->handle_signal (0, &sig) == -1) { - this->handler_rep_.unbind (handle); + this->handler_rep_.unbind (handle, ACE_Event_Handler::NULL_MASK); return -1; } else diff --git a/ace/ReactorEx.h b/ace/ReactorEx.h index 300cc643e62..0dad1b2f205 100644 --- a/ace/ReactorEx.h +++ b/ace/ReactorEx.h @@ -61,7 +61,7 @@ public: // = Search structure operations. - ACE_Event_Handler *find (size_t index); + ACE_Event_Handler *find (size_t index) const; // Return the <ACE_Event_Handler *> associated with <index>. Return // 0 if <index> is invalid. diff --git a/ace/ReactorEx.i b/ace/ReactorEx.i index 7985a10dad5..047c3f40b35 100644 --- a/ace/ReactorEx.i +++ b/ace/ReactorEx.i @@ -29,22 +29,22 @@ ACE_ReactorEx::handle_events (ACE_Time_Value &how_long, } ACE_INLINE ACE_HANDLE * -ACE_ReactorEx::handles (void) const +ACE_ReactorEx_Handler_Repository::handles (void) const { return this->handles_; } ACE_INLINE size_t -ACE_ReactorEx_Handler_Repository::max_handlep1 (void) +ACE_ReactorEx_Handler_Repository::max_handlep1 (void) const { return this->max_handlep1_; } ACE_INLINE ACE_Event_Handler * -ACE_ReactorEx_Handler_Repository::find (size_t index) +ACE_ReactorEx_Handler_Repository::find (size_t index) const { if (this->handle_in_range (index)) - return this->event_handlers_[i]; + return this->event_handlers_[index]; else { errno = ENOENT; diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp index 442ae796a0d..e4322a14659 100644 --- a/ace/Service_Config.cpp +++ b/ace/Service_Config.cpp @@ -757,7 +757,10 @@ ACE_Service_Config::end_reactor_event_loop (void) ACE_TRACE ("ACE_Service_Config::end_reactor_event_loop"); ACE_Service_Config::end_reactor_event_loop_ = 1; - return ACE_Service_Config::reactor ()->notify (); + // Send a notification, but don't block if there's no one to receive + // it. + return ACE_Service_Config::reactor ()->notify + (0, ACE_Event_Handler::NULL_MASK, &ACE_Time_Value::zero); } /* static */ diff --git a/ace/Synch.i b/ace/Synch.i index 0a0dadd4831..2da2feba59a 100644 --- a/ace/Synch.i +++ b/ace/Synch.i @@ -447,6 +447,7 @@ ACE_INLINE int ACE_Thread_Mutex_Guard::remove (void) { // ACE_TRACE ("ACE_Thread_Mutex_Guard::remove"); + this->owner_ = -1; return this->release (); } diff --git a/ace/Synch_T.cpp b/ace/Synch_T.cpp index 9cab6f23136..83fa37e38e8 100644 --- a/ace/Synch_T.cpp +++ b/ace/Synch_T.cpp @@ -42,6 +42,9 @@ ACE_Test_and_Set<LOCK, TYPE>::set (TYPE status) template <class LOCK, class TYPE> int ACE_Test_and_Set<LOCK, TYPE>::handle_signal (int, siginfo_t *, ucontext_t *) { + // By setting this to 1, we are "signaling" to anyone calling + // <is_set> or or <set> that the "test and set" object is in the + // "signaled" state, i.e., it's "available" to be set back to 0. this->set (1); return 0; } @@ -193,6 +196,9 @@ ACE_ALLOC_HOOK_DEFINE(ACE_TSS) template <class TYPE> ACE_TSS<TYPE>::~ACE_TSS (void) { + // We can't call <ACE_OS::thr_keyfree> until *all* of the threads + // that are using that key have done an <ACE_OS::thr_key_detach>. + // Otherwise, we'll end up with "dangling TSS pointers." ACE_OS::thr_key_detach (this); } @@ -531,7 +537,7 @@ ACE_TSS_Guard<LOCK>::~ACE_TSS_Guard (void) #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; ACE_Thread::getspecific (this->key_, (void **) &tss_adapter); - guard = (ACE_Guard<LOCK> *)tss_adapter->ts_obj_; + guard = (ACE_Guard<LOCK> *) tss_adapter->ts_obj_; #else ACE_Thread::getspecific (this->key_, (void **) &guard); #endif /* ACE_HAS_THR_C_DEST */ diff --git a/ace/Synch_T.h b/ace/Synch_T.h index ee3ab76422e..5cf4d901f97 100644 --- a/ace/Synch_T.h +++ b/ace/Synch_T.h @@ -82,7 +82,11 @@ class ACE_Test_and_Set : public ACE_Event_Handler // // = DESCRIPTION // This class keeps track of the status of <is_set_>, which can - // be set based on various events (such as receipt of a signal). + // be set based on various events (such as receipt of a + // signal). This class is derived from <ACE_Event_Handler> so + // that it can be "signaled" by a Reactor when a signal occurs. + // We assume that <TYPE> is a data type that can be assigned the + // value 0 or 1. public: ACE_Test_and_Set (TYPE initial_value = 0); @@ -90,9 +94,12 @@ public: // Returns true if we are set, else false. TYPE set (TYPE); - // Sets the <set_> status, returning + // Sets the <is_set_> status, returning the original value of + // <is_set_>. - virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); + virtual int handle_signal (int signum, + siginfo_t * = 0, + ucontext_t * = 0); // Called when object is signaled by OS (either via UNIX signals or // when a Win32 object becomes signaled). @@ -101,6 +108,7 @@ private: // Keeps track of our state. LOCK lock_; + // Protect the state from race conditions. }; template <class LOCK, class TYPE> diff --git a/ace/Task.h b/ace/Task.h index 2a06e92f986..dec495683b6 100644 --- a/ace/Task.h +++ b/ace/Task.h @@ -63,7 +63,12 @@ public: virtual int close (u_long flags = 0); // Hook called from ACE_Task_Exit when during thread exit and from - // the default implemenation of module_closed(). + // the default implemenation of <module_closed>. In general, this + // method shouldn't be called directly by an application, + // particularly if the <Task> is running as an Active Object. + // Instead, a special message should be passed into the <Task> via + // the <put> method defined below, and the <svc> method should + // interpret this as a flag to shut down the <Task>. virtual int module_closed (void); // Hook called during ACE_Module::close(). The default diff --git a/examples/Reactor/Misc/notification.cpp b/examples/Reactor/Misc/notification.cpp index 28e457b084f..b392fa1d86a 100644 --- a/examples/Reactor/Misc/notification.cpp +++ b/examples/Reactor/Misc/notification.cpp @@ -49,7 +49,7 @@ private: size_t id_; // ID passed in by Thread_Handler constructor. - sig_atomic_t shutdown_; + static sig_atomic_t shutdown_; // Shutting down. // = Timing variables. @@ -60,6 +60,9 @@ private: static ACE_Time_Value interval_; }; +// Shutdown flag. +sig_atomic_t Thread_Handler::shutdown_ = 0; + // Delay factor for timer-driven I/O. ACE_Time_Value Thread_Handler::delay_; @@ -69,7 +72,6 @@ ACE_Time_Value Thread_Handler::interval_; Thread_Handler::Thread_Handler (int delay, int interval, int n_threads) - : shutdown_ (0) { delay_.set (delay); interval_.set (interval); @@ -110,23 +112,6 @@ Thread_Handler::Thread_Handler (int delay, ACE_Thread::sigsetmask (SIG_UNBLOCK, sig_set); } -// Test stdin handling (can use select to demultiplex HANDLEs) - -int -Thread_Handler::handle_input (ACE_HANDLE handle) -{ - char buf[BUFSIZ]; - ssize_t n = ACE_OS::read (handle, buf, sizeof buf); - - if (n > 0) - { - ACE_DEBUG ((LM_DEBUG, "(%t) %*s", n, buf)); - return this->notify (); - } - else - return -1; -} - int Thread_Handler::notify (ACE_Time_Value *timeout) { @@ -144,6 +129,29 @@ Thread_Handler::notify (ACE_Time_Value *timeout) return 0; } +// Test stdin handling (can use select to demultiplex HANDLEs) + +int +Thread_Handler::handle_input (ACE_HANDLE handle) +{ + char buf[BUFSIZ]; + ssize_t n = ACE_OS::read (handle, buf, sizeof buf); + + if (n > 0) + { + ACE_DEBUG ((LM_DEBUG, "(%t) %*s", n, buf)); + + // Only wait up to 10 milliseconds to notify the Reactor. + ACE_Time_Value timeout (0, 10 * 1000); + + if (this->notify (&timeout) == -1) + ACE_ERROR ((LM_DEBUG, "(%t), %p\n", "notify")); + return 0; + } + else + return -1; +} + // Perform a task that will test the ACE_Reactor's multi-threading // capabilities in separate threads. @@ -160,8 +168,10 @@ Thread_Handler::svc (void) ACE_Time_Value timeout (0, 10 * 1000); if (notify (&timeout) == -1) - ACE_DEBUG ((LM_DEBUG, "(%t) %p\n", "notify()")); + ACE_ERROR ((LM_ERROR, "(%t) %p\n", "notify")); } + + ACE_DEBUG ((LM_DEBUG, "(%t) exiting svc\n")); return 0; } diff --git a/examples/Reactor/Misc/test_reactors.cpp b/examples/Reactor/Misc/test_reactors.cpp index 834d6f5bf98..4910cf5fff4 100644 --- a/examples/Reactor/Misc/test_reactors.cpp +++ b/examples/Reactor/Misc/test_reactors.cpp @@ -140,10 +140,10 @@ worker (void *args) switch (reactor->handle_events (timeout)) { case -1: - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "reactor"), 0); + ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "reactor"), 0); /* NOTREACHED */ case 0: - ACE_ERROR_RETURN ((LM_ERROR, "timeout\n"), 0); + ACE_ERROR_RETURN ((LM_ERROR, "(%t) timeout\n"), 0); /* NOTREACHED */ } diff --git a/netsvcs/clients/Naming/Dump_Restore/createfile.cpp b/netsvcs/clients/Naming/Dump_Restore/createfile.cpp index fbd85b78768..922793c7c51 100644 --- a/netsvcs/clients/Naming/Dump_Restore/createfile.cpp +++ b/netsvcs/clients/Naming/Dump_Restore/createfile.cpp @@ -1,6 +1,6 @@ -#include <stdio.h> // $Id$ +#include <stdio.h> #include <string.h> #include <math.h> |