diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-05-03 22:44:29 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-05-03 22:44:29 +0000 |
commit | 6fdc123c601a3f58942924c639757df366049743 (patch) | |
tree | f259a828748eac9e886983e3f9d3e44f0a0a8d1c | |
parent | 440ffb3f2559ea0ea76be0f1502f4d094fb7eeab (diff) | |
download | ATCD-6fdc123c601a3f58942924c639757df366049743.tar.gz |
*** empty log message ***
40 files changed, 414 insertions, 211 deletions
diff --git a/ChangeLog-97a b/ChangeLog-97a index 36a7eab7348..2f3b37b6860 100644 --- a/ChangeLog-97a +++ b/ChangeLog-97a @@ -1,3 +1,49 @@ +Sat May 3 17:38:19 1997 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> + + * Changed all uses of Reactor::{scheduler_timer,cancel}() and + Timer_{Queue,List,Heap,Wheel}::{schedule,cancel}() to use + long rather than int. This is important since it ensures that + we can make the Timing Wheels trick of casting the + Timer_Node * to long work correctly on machines that have 64 + bit pointers, 64 bit longs, and 32 bit ints (e.g,. DEC + ALPHA). Thanks to Thilo Kielmann <kielmann@informatik.uni-siegen.de> for + pointing this out, even though he finds this solution + distasteful ;-). + + * netsvcs/lib/TS_Clerk_Handler.cpp (initiate_connection): I + believe there was also a bug here -- if schedule_timer() returns + 0 that's not an error! + + * apps/Gateway/Gateway/Proxy_Handler_Connector.cpp + (initiate_connection): I believe there was a bug here -- if + schedule_timer() returns 0 that's not an error! + +Sat May 3 12:14:01 1997 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu> + + * tests/IOStream_Test.cpp: Added some minor changes for DEC UNIX. + Thanks to James CE Johnson <jjohnson@lads.com> for reporting + this. + + * ace/IOStream: Added a number of minor changes for DEC UNIX. + Thanks to James CE Johnson <jjohnson@lads.com> for reporting + this. + + * ace/config-osf1-4.0.h: Added + ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS to the config.h file. + Thanks to James CE Johnson <jjohnson@lads.com> for reporting + this. + + * ace/SString: Made the ace_string_null_string_ a static data + member rather than an external constant. This should control + the name space a bit better. + + * ace/SString.cpp: Fixed the ACE_CString::operator += so that it + won't screw up if this->rep_ initially points to the + ACE_String_null_string_. + + * examples/Misc: Added a new test_set.cpp program that exercises + the ACE_*_Set classes. + Sat May 03 06:56:10 1997 David L. Levine <levine@cs.wustl.edu> * ace/Map_Manager.cpp (dtor): removed void return (typo). diff --git a/ace/IOStream.cpp b/ace/IOStream.cpp index e12a466288b..6c182b0f6bd 100644 --- a/ace/IOStream.cpp +++ b/ace/IOStream.cpp @@ -1,7 +1,7 @@ // IOStream.cpp // $Id$ -#ifndef ACE_IOSTREAM_C +#if !defined (ACE_IOSTREAM_C) #define ACE_IOSTREAM_C #define ACE_BUILD_DLL @@ -14,7 +14,6 @@ /* Here's a simple example of how iostream's non-virtual operators can get you in a mess: - class myiostream : public iostream { public: @@ -651,12 +650,14 @@ ACE_IOStream<STREAM>::ACE_IOStream (STREAM & stream, u_int streambuf_size) : iostream (streambuf_ = new ACE_Streambuf<STREAM> ((STREAM *) this, streambuf_size)), STREAM (stream) { + iostream::init (this->streambuf_); } template <class STREAM> ACE_IOStream<STREAM>::ACE_IOStream (u_int streambuf_size) : iostream (streambuf_ = new ACE_Streambuf<STREAM> ((STREAM *) this, streambuf_size)) { + iostream::init (this->streambuf_); } // We have to get rid of the streambuf_ ourselves since we gave it to diff --git a/ace/IOStream.h b/ace/IOStream.h index 0b1ef15ce28..b1fff35c349 100644 --- a/ace/IOStream.h +++ b/ace/IOStream.h @@ -111,7 +111,7 @@ public: return (QuotedString&) ACE_IOStream_String::operator= (c); } inline bool operator < (const QuotedString& s) const { - return * (ACE_IOStream_String *)this < (ACE_IOStream_String)s; + return *(ACE_IOStream_String *) this < (ACE_IOStream_String) s; } #if defined (ACE_WIN32) inline int length (void) { return this->GetLength (); } @@ -379,7 +379,14 @@ typedef ostream& (*__omanip_)(ostream&); // operators. Notice how the ipfx() and isfx() functions are used. #define GET_SIG(MT,DT) inline virtual MT& operator>> (DT v) -#define GET_CODE { if (ipfx ()) iostream::operator>> (v); isfx (); return *this; } +#define GET_CODE { \ + if (ipfx (0)) \ + { \ + iostream::operator>> (v); \ + } \ + isfx (); \ + return *this; \ + } #define GET_PROT(MT,DT,CODE) GET_SIG(MT,DT) CODE #define GET_FUNC(MT,DT) GET_PROT(MT,DT,GET_CODE) @@ -388,7 +395,14 @@ typedef ostream& (*__omanip_)(ostream&); // operators. Notice how the opfx() and osfx() functions are used. #define PUT_SIG(MT,DT) inline virtual MT& operator<< (DT v) -#define PUT_CODE { if (opfx ()) iostream::operator<< (v); osfx (); return *this; } +#define PUT_CODE { \ + if (opfx ()) \ + { \ + iostream::operator<< (v); \ + } \ + osfx (); \ + return *this; \ + } #define PUT_PROT(MT,DT,CODE) PUT_SIG(MT,DT) CODE #define PUT_FUNC(MT,DT) PUT_PROT(MT,DT,PUT_CODE) @@ -405,7 +419,6 @@ typedef ostream& (*__omanip_)(ostream&); GET_PROT(MT,u_long &,CODE) \ GET_PROT(MT,float &,CODE) \ GET_PROT(MT,double &,CODE) \ - GET_PROT(MT,long double &,CODE) \ GET_PROT(MT,char &,CODE) \ GET_PROT(MT,u_char &,CODE) \ GET_PROT(MT,char *,CODE) \ @@ -533,24 +546,24 @@ public: #endif /* ACE_LACKS_IOSTREAM_SETSET */ #if defined (ACE_LACKS_IOSTREAM_FX) - virtual int ipfx (int need = 0) { ACE_UNUSED_ARG (need); return good(); } - virtual int ipfx0(void) { return good(); } // Optimized ipfx(0) - virtual int ipfx1(void) { return good(); } // Optimized ipfx(1) - virtual void isfx (void) { } - virtual int opfx (void) { return good(); } - virtual void osfx (void) { put(' '); } + virtual int ipfx (int need = 0) { return good(); } + virtual int ipfx0(void) { return good(); } // Optimized ipfx(0) + virtual int ipfx1(void) { return good(); } // Optimized ipfx(1) + virtual void isfx (void) { return; } + virtual int opfx (void) { return good(); } + virtual void osfx (void) { put(' '); return; } #else #if defined (__GNUC__) virtual int ipfx0(void) { return(iostream::ipfx0()); } // Optimized ipfx(0) virtual int ipfx1(void) { return(iostream::ipfx1()); } // Optimized ipfx(1) #else - virtual int ipfx0(void) { return(iostream::ipfx(0)); } - virtual int ipfx1(void) { return(iostream::ipfx(1)); } + virtual int ipfx0(void) { return(iostream::ipfx(0)); } + virtual int ipfx1(void) { return(iostream::ipfx(1)); } #endif - virtual int ipfx (int need = 0) { return(iostream::ipfx(need)); } - virtual void isfx (void) { iostream::isfx(); } - virtual int opfx (void) { return(iostream::opfx()); } - virtual void osfx (void) { iostream::osfx(); } + virtual int ipfx (int need = 0) { return(iostream::ipfx(need)); } + virtual void isfx (void) { iostream::isfx(); return; } + virtual int opfx (void) { return(iostream::opfx()); } + virtual void osfx (void) { iostream::osfx(); return; } #endif /* ACE_LACKS_IOSTREAM_FX */ ACE_IOStream & operator>>( ACE_Time_Value *& tv ); diff --git a/ace/Reactor.cpp b/ace/Reactor.cpp index 687f595907d..16117c84594 100644 --- a/ace/Reactor.cpp +++ b/ace/Reactor.cpp @@ -1084,7 +1084,7 @@ ACE_Reactor::remove_handler (const ACE_Sig_Set &sigset) // Note the queue handles its own locking. -int +long ACE_Reactor::schedule_timer (ACE_Event_Handler *handler, const void *arg, const ACE_Time_Value &delta_time, diff --git a/ace/Reactor.h b/ace/Reactor.h index bc062242ec3..6738d878e87 100644 --- a/ace/Reactor.h +++ b/ace/Reactor.h @@ -444,10 +444,10 @@ public: // Resume all the <Event_Handlers> in the Reactor. // = Timer management. - virtual int schedule_timer (ACE_Event_Handler *, - const void *arg, - const ACE_Time_Value &delta, - const ACE_Time_Value &interval = ACE_Time_Value::zero); + virtual long schedule_timer (ACE_Event_Handler *, + const void *arg, + const ACE_Time_Value &delta, + const ACE_Time_Value &interval = ACE_Time_Value::zero); // Schedule an <event_handler> that will expire after <delay> amount // of time. If it expires then <arg> is passed in as the value to // the <event_handler>'s <handle_timeout> callback method. If @@ -469,7 +469,7 @@ public: // <handle_close> method of <event_handler> will be invoked. // Returns number of handler's cancelled. - virtual int cancel_timer (int timer_id, + virtual int cancel_timer (long timer_id, const void **arg = 0, int dont_call_handle_close = 1); // Cancel the single <ACE_Event_Handler> that matches the <timer_id> diff --git a/ace/Reactor.i b/ace/Reactor.i index 8d3af9e94c3..2566aba6b3a 100644 --- a/ace/Reactor.i +++ b/ace/Reactor.i @@ -47,9 +47,8 @@ ACE_Reactor::remove_handler (int signum, return this->signal_handler_->remove_handler (signum, new_disp, old_disp, sigkey); } -// The remaining methods in this file must be called with locks held - -// Note the queue handles its own locking. +// = The remaining methods in this file must be called with locks +// held. Note the queue handles its own locking. ACE_INLINE int ACE_Reactor::cancel_timer (ACE_Event_Handler *handler, @@ -61,12 +60,13 @@ ACE_Reactor::cancel_timer (ACE_Event_Handler *handler, } ACE_INLINE int -ACE_Reactor::cancel_timer (int timer_id, +ACE_Reactor::cancel_timer (long timer_id, const void **arg, int dont_call_handle_close) { ACE_TRACE ("ACE_Reactor::cancel_timer"); - return this->timer_queue_->cancel (timer_id, arg, + return this->timer_queue_->cancel (timer_id, + arg, dont_call_handle_close); } diff --git a/ace/SString.cpp b/ace/SString.cpp index 424b266c605..8917b6d4fb5 100644 --- a/ace/SString.cpp +++ b/ace/SString.cpp @@ -12,7 +12,7 @@ ACE_ALLOC_HOOK_DEFINE(ACE_CString) -char ACE_String_null_string_ = '\0'; +char ACE_CString::NULL_CString_ = '\0'; // Copy constructor. @@ -27,7 +27,7 @@ ACE_CString::ACE_CString (const ACE_CString &s) if (s.fast_rep ()[0] == '\0') { - this->rep_ = &ACE_String_null_string_; + this->rep_ = &ACE_CString::NULL_CString_; } else { @@ -47,7 +47,7 @@ ACE_CString::~ACE_CString (void) { ACE_TRACE ("ACE_CString::~ACE_CString"); - if (this->rep_ != &ACE_String_null_string_) + if (this->rep_ != &ACE_CString::NULL_CString_) { this->allocator_->free (this->rep_); } @@ -65,7 +65,7 @@ ACE_CString::length (void) const ACE_CString::ACE_CString (ACE_Allocator *alloc) : allocator_ (alloc), len_ (0), - rep_ (&ACE_String_null_string_) + rep_ (&ACE_CString::NULL_CString_) { ACE_TRACE ("ACE_CString::ACE_CString"); @@ -86,7 +86,7 @@ ACE_CString::ACE_CString (const char *s, ACE_Allocator *alloc) if (s == 0 || s[0] == 0') { this->len_ = 0; - this->rep_ = &ACE_String_null_string_; + this->rep_ = &ACE_CString::NULL_CString_; } else { @@ -111,7 +111,7 @@ ACE_CString::ACE_CString (const ACE_USHORT16 *s, ACE_Allocator *alloc) if (s == 0 || s[0] == (ACE_USHORT16) '\0') { this->len_ = 0; - this->rep_ = &ACE_String_null_string_; + this->rep_ = &ACE_CString::NULL_CString_; } else { @@ -141,7 +141,7 @@ ACE_CString::ACE_CString (const char *s, if (s == 0 || s[0] == '\0') { this->len_ = 0; - this->rep_ = &ACE_String_null_string_; + this->rep_ = &ACE_CString::NULL_CString_; } else { @@ -165,22 +165,19 @@ ACE_CString::operator = (const ACE_CString &s) // Only reallocate if we don't have enough space... if (this->len_ < s.len_) { - if (this->rep_ != &ACE_String_null_string_) - { - this->allocator_->free (this->rep_); - } + if (this->rep_ != &ACE_CString::NULL_CString_) + this->allocator_->free (this->rep_); + // s.len_ is greather than 0, so must allocate space for it. this->rep_ = (char *) this->allocator_->malloc (s.len_ + 1); } + this->len_ = s.len_; + if (s[0] == '\0') - { - this->rep_ = &ACE_String_null_string_; - } + this->rep_ = &ACE_CString::NULL_CString_; else - { - ACE_OS::strcpy (this->rep_, s.rep_); - } + ACE_OS::strcpy (this->rep_, s.rep_); } } @@ -226,19 +223,26 @@ ACE_CString::operator += (const ACE_CString &s) if (s.len_ > 0) { - if (this->len_ > 0) - { - char *t = (char *) this->allocator_->malloc (this->len_ + s.len_ + 1); - ACE_OS::memcpy (t, this->rep_, this->len_); - ACE_OS::memcpy (t + this->len_, s.rep_, s.len_); - this->len_ += s.len_; - t[this->len_] = '\0'; - if (this->rep_ != &ACE_String_null_string_) - { - this->allocator_->free (this->rep_); - } - this->rep_ = t; - } + size_t oldlen = this->len_; + size_t newlen = oldlen + s.len_ + 1; + this->len_ += s.len_; + char *t = 0; + + if (oldlen < newlen) + { + // Allocate memory for the new string. + ACE_ALLOCATOR (t, + (char *) this->allocator_->malloc (newlen)); + // Copy memory from old string into new string. + ACE_OS::memcpy (t, this->rep_, oldlen); + } + + ACE_OS::memcpy (t + oldlen, s.rep_, s.len_); + t[this->len_] = '\0'; + + if (this->rep_ != &ACE_CString::NULL_CString_) + this->allocator_->free (this->rep_); + this->rep_ = t; } } diff --git a/ace/SString.h b/ace/SString.h index 5f778e50954..04f7af84f63 100644 --- a/ace/SString.h +++ b/ace/SString.h @@ -109,6 +109,9 @@ private: char *rep_; // Pointer to data. + + static char NULL_CString_; + // Represents the "NULL" string to simplify the internal logic. }; class ACE_Export ACE_SString diff --git a/ace/Set.cpp b/ace/Set.cpp index eb7894a906a..d13b1ee2055 100644 --- a/ace/Set.cpp +++ b/ace/Set.cpp @@ -491,7 +491,22 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Set) template <class T> void ACE_Unbounded_Set<T>::dump (void) const { -// ACE_TRACE ("ACE_Unbounded_Set<T>::dump"); + ACE_TRACE ("ACE_Unbounded_Set<T>::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, "\nhead_ = %u", this->head_)); + ACE_DEBUG ((LM_DEBUG, "\nhead_->next_ = %u", this->head_->next_)); + ACE_DEBUG ((LM_DEBUG, "\ncur_size_ = %d\n", this->cur_size_)); + + T *item = 0; + size_t count = 1; + + for (ACE_Unbounded_Set_Iterator<T> iter (*(ACE_Unbounded_Set<T> *) this); + iter.next (item) != 0; + iter.advance ()) + ACE_DEBUG ((LM_DEBUG, "count = %d\n", count++)); + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } template <class T> void @@ -581,21 +596,25 @@ ACE_Unbounded_Set<T>::find (T &item, size_t index) const template <class T> ACE_Unbounded_Set<T>::ACE_Unbounded_Set (void) - : head_ (new ACE_Set_Node<T>), + : head_ (0), cur_size_ (0) { // ACE_TRACE ("ACE_Unbounded_Set<T>::ACE_Unbounded_Set"); + + ACE_NEW (this->head_, ACE_Set_Node<T>); + // Make the list circular by pointing it back to itself. this->head_->next_ = this->head_; } template <class T> ACE_Unbounded_Set<T>::ACE_Unbounded_Set (const ACE_Unbounded_Set<T> &us) - : head_ (new ACE_Set_Node<T>), - cur_size_ (us.cur_size_) + : head_ (0), + cur_size_ (0) { ACE_TRACE ("ACE_Unbounded_Set<T>::ACE_Unbounded_Set"); + ACE_NEW (this->head_, ACE_Set_Node<T>); this->head_->next_ = this->head_; this->copy_nodes (us); } @@ -619,8 +638,19 @@ ACE_Unbounded_Set<T>::insert_tail (const T &item) { // ACE_TRACE ("ACE_Unbounded_Set<T>::insert"); ACE_Set_Node<T> *temp; - ACE_NEW_RETURN (temp, ACE_Set_Node<T> (item, this->head_->next_), -1); + + // Insert <item> into the old dummy node location. + this->head_->item_ = item; + + // Create a new dummy node. + ACE_NEW_RETURN (temp, ACE_Set_Node<T> (this->head_->next_), -1); + + // Link this pointer into the list. this->head_->next_ = temp; + + // Point the head to the new dummy node. + this->head_ = temp; + this->cur_size_++; return 0; } diff --git a/ace/Timer_Heap_T.cpp b/ace/Timer_Heap_T.cpp index b12d7f753a8..a788295faf8 100644 --- a/ace/Timer_Heap_T.cpp +++ b/ace/Timer_Heap_T.cpp @@ -435,7 +435,7 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR>::free_node (ACE_Timer_Node_T<TYPE, FUNCTOR> *nod // > 0, the handler will be reinvoked periodically. -template <class TYPE, class FUNCTOR> int +template <class TYPE, class FUNCTOR> long ACE_Timer_Heap_T<TYPE, FUNCTOR>::schedule (const TYPE &type, const void *act, const ACE_Time_Value &future_time, @@ -475,7 +475,7 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR>::schedule (const TYPE &type, // the timer queue. template <class TYPE, class FUNCTOR> int -ACE_Timer_Heap_T<TYPE, FUNCTOR>::cancel (int timer_id, +ACE_Timer_Heap_T<TYPE, FUNCTOR>::cancel (long timer_id, const void **act, int dont_call) { @@ -484,7 +484,7 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR>::cancel (int timer_id, // Locate the ACE_Timer_Node that corresponds to the timer_id. - int timer_node_slot = this->timer_ids_[timer_id]; + long timer_node_slot = this->timer_ids_[timer_id]; if (timer_id != this->heap_[timer_node_slot]->timer_id_) { @@ -498,6 +498,7 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR>::cancel (int timer_id, if (dont_call == 0) // Call the close hook. this->upcall_functor_.operator () (*this, temp->type_); + if (act != 0) *act = temp->act_; diff --git a/ace/Timer_Heap_T.h b/ace/Timer_Heap_T.h index 7bf0c9d4f9f..4c7a7a3be1f 100644 --- a/ace/Timer_Heap_T.h +++ b/ace/Timer_Heap_T.h @@ -90,10 +90,10 @@ public: virtual const ACE_Time_Value &earliest_time (void) const; // Returns the time of the earlier node in the Timer_Queue. - virtual int schedule (const TYPE &type, - const void *act, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval = ACE_Time_Value::zero); + virtual long schedule (const TYPE &type, + const void *act, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval = ACE_Time_Value::zero); // Schedule <type> that will expire after <delay> amount of time. // If it expires then <act> is passed in as the value to the // <functor>. If <interval> is != to <ACE_Time_Value::zero> then it @@ -113,7 +113,7 @@ public: // then the <functor> will be invoked. Returns number of timers // cancelled. - virtual int cancel (int timer_id, + virtual int cancel (long timer_id, const void **act = 0, int dont_call_handle_close = 1); // Cancel the single timer that matches the <timer_id> value (which @@ -197,7 +197,7 @@ private: // ordered, almost complete" binary tree, which is stored in an // array. - int *timer_ids_; + long *timer_ids_; // An array of "pointers" that allows each <ACE_Timer_Node> in the // <heap_> to be located in O(1) time. Basically, <timer_id_[i]> // contains the index in the <heap_> array where an <ACE_Timer_Node> @@ -207,7 +207,7 @@ private: // treated as "pointers" for the <freelist_>, whereas positive // values are treated as "pointers" into the <heap_> array. - int timer_ids_freelist_; + long timer_ids_freelist_; // "Pointer" to the first element in the freelist contained within // the <timer_ids_> array, which is organized as a stack. diff --git a/ace/Timer_List_T.cpp b/ace/Timer_List_T.cpp index aaeba15dbe5..4cb32a6f063 100644 --- a/ace/Timer_List_T.cpp +++ b/ace/Timer_List_T.cpp @@ -147,7 +147,7 @@ ACE_Timer_List_T<TYPE, FUNCTOR>::reschedule (ACE_Timer_Node_T<TYPE, FUNCTOR> *ex // is > 0, the handler will be reinvoked periodically. -template <class TYPE, class FUNCTOR> int +template <class TYPE, class FUNCTOR> long ACE_Timer_List_T<TYPE, FUNCTOR>::schedule (const TYPE &type, const void *act, const ACE_Time_Value &future_time, @@ -157,7 +157,7 @@ ACE_Timer_List_T<TYPE, FUNCTOR>::schedule (const TYPE &type, ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); // Increment the sequence number (it will wrap around). - int timer_id = this->timer_id (); + long timer_id = this->timer_id (); if (this->is_empty () || future_time < this->earliest_time ()) { @@ -218,7 +218,7 @@ ACE_Timer_List_T<TYPE, FUNCTOR>::timer_id (void) template <class TYPE, class FUNCTOR> int -ACE_Timer_List_T<TYPE, FUNCTOR>::cancel (int timer_id, +ACE_Timer_List_T<TYPE, FUNCTOR>::cancel (long timer_id, const void **act, int dont_call) { diff --git a/ace/Timer_List_T.h b/ace/Timer_List_T.h index 2782530be8e..fd56b93c2e8 100644 --- a/ace/Timer_List_T.h +++ b/ace/Timer_List_T.h @@ -93,10 +93,10 @@ public: virtual const ACE_Time_Value &earliest_time (void) const; // Returns the time of the earlier node in the <ACE_Timer_List>. - virtual int schedule (const TYPE &type, - const void *act, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval = ACE_Time_Value::zero); + virtual long schedule (const TYPE &type, + const void *act, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval = ACE_Time_Value::zero); // Schedule <type> that will expire after <delay> amount of time. // If it expires then <act> is passed in as the value to the // <functor>. If <interval> is != to <ACE_Time_Value::zero> then it @@ -116,7 +116,7 @@ public: // then the <functor> will be invoked. Returns number of timers // cancelled. - virtual int cancel (int timer_id, + virtual int cancel (long timer_id, const void **act = 0, int dont_call_handle_close = 1); // Cancel the single timer that matches the <timer_id> value (which @@ -157,7 +157,7 @@ private: LIST_ITERATOR iterator_; // Iterator used to expire timers. - int timer_id_; + long timer_id_; // Keeps track of the timer id that uniquely identifies each timer. // This id can be used to cancel a timer via the <cancel (int)> // method. diff --git a/ace/Timer_Queue_T.h b/ace/Timer_Queue_T.h index 8dedf64ea24..f79868e194c 100644 --- a/ace/Timer_Queue_T.h +++ b/ace/Timer_Queue_T.h @@ -65,7 +65,7 @@ class ACE_Timer_Node_T const ACE_Time_Value &t, const ACE_Time_Value &i, ACE_Timer_Node_T<TYPE, FUNCTOR> *n, - int timer_id); + long timer_id); // Constructor. ACE_Timer_Node_T (const TYPE &type, @@ -74,7 +74,7 @@ class ACE_Timer_Node_T const ACE_Time_Value &i, ACE_Timer_Node_T<TYPE, FUNCTOR> *p, ACE_Timer_Node_T<TYPE, FUNCTOR> *n, - int timer_id); + long timer_id); // Constructor for the doubly linked list version. @@ -100,7 +100,7 @@ class ACE_Timer_Node_T ACE_Timer_Node_T<TYPE, FUNCTOR> *next_; // Pointer to next timer. - int timer_id_; + long timer_id_; // Id of this timer (used to cancel timers before they expire). ACE_ALLOC_HOOK_DECLARE; @@ -166,10 +166,10 @@ public: virtual const ACE_Time_Value &earliest_time (void) const = 0; // Returns the time of the earlier node in the Timer_Queue. - virtual int schedule (const TYPE &type, - const void *act, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval = ACE_Time_Value::zero) = 0; + virtual long schedule (const TYPE &type, + const void *act, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval = ACE_Time_Value::zero) = 0; // Schedule <type> that will expire after <delay> amount of time. // If it expires then <act> is passed in as the value to the // <functor>. If <interval> is != to <ACE_Time_Value::zero> then it @@ -189,7 +189,7 @@ public: // then the <functor> will be invoked. Returns number of timers // cancelled. - virtual int cancel (int timer_id, + virtual int cancel (long timer_id, const void **act = 0, int dont_call_handle_close = 1) = 0; // Cancel the single timer that matches the <timer_id> value (which diff --git a/ace/Timer_Wheel_T.cpp b/ace/Timer_Wheel_T.cpp index aef170018f8..a50d534dbf3 100644 --- a/ace/Timer_Wheel_T.cpp +++ b/ace/Timer_Wheel_T.cpp @@ -158,7 +158,7 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR>::earliest_time (void) const } -template <class TYPE, class FUNCTOR> int +template <class TYPE, class FUNCTOR> long ACE_Timer_Wheel_T<TYPE, FUNCTOR>::schedule (const TYPE &type, const void *act, const ACE_Time_Value &delay, @@ -170,21 +170,21 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR>::schedule (const TYPE &type, ACE_Timer_Node_T<TYPE, FUNCTOR> *tempnode = this->alloc_node (); if (tempnode) - { - // Note that the timer_id is actually the pointer to the node + { + // Note that the timer_id is actually the pointer to the node - // Use operator placement new. - new (tempnode) ACE_Timer_Node_T<TYPE, FUNCTOR> (type, - act, - delay, - interval, - NULL, - NULL, - (int) tempnode); - - this->reschedule (tempnode); - return tempnode->timer_id_; - } + // Use operator placement new. + new (tempnode) ACE_Timer_Node_T<TYPE, FUNCTOR> (type, + act, + delay, + interval, + NULL, + NULL, + (long) tempnode); + + this->reschedule (tempnode); + return tempnode->timer_id_; + } // Failure return. errno = ENOMEM; @@ -235,7 +235,7 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR>::cancel (const TYPE &type, } template <class TYPE, class FUNCTOR> int -ACE_Timer_Wheel_T<TYPE, FUNCTOR>::cancel (int timer_id, +ACE_Timer_Wheel_T<TYPE, FUNCTOR>::cancel (long timer_id, const void **act, int dont_call_handle_close) { diff --git a/ace/Timer_Wheel_T.h b/ace/Timer_Wheel_T.h index 9ebba1a0ff8..fb68dcd1840 100644 --- a/ace/Timer_Wheel_T.h +++ b/ace/Timer_Wheel_T.h @@ -99,10 +99,10 @@ public: virtual const ACE_Time_Value &earliest_time (void) const; // Returns the time of the earlier node in the <ACE_Timer_Wheel>. - virtual int schedule (const TYPE &type, - const void *act, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval = ACE_Time_Value::zero); + virtual long schedule (const TYPE &type, + const void *act, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval = ACE_Time_Value::zero); // Schedule <type> that will expire after <delay> amount of time. // If it expires then <act> is passed in as the value to the // <functor>. If <interval> is != to <ACE_Time_Value::zero> then it @@ -122,7 +122,7 @@ public: // then the <functor> will be invoked. Returns number of timers // cancelled. - virtual int cancel (int timer_id, + virtual int cancel (long timer_id, const void **act = 0, int dont_call_handle_close = 1); // Cancel the single timer that matches the <timer_id> value (which diff --git a/ace/config-osf1-4.0-g++.h b/ace/config-osf1-4.0-g++.h index de39278a23a..d56f884ff93 100644 --- a/ace/config-osf1-4.0-g++.h +++ b/ace/config-osf1-4.0-g++.h @@ -22,6 +22,8 @@ // Must specialize templates due to G++'s lame parameterized type // support... #define ACE_TEMPLATES_REQUIRE_SPECIALIZATION +#define ACE_LACKS_SIGNED_CHAR +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS #define ACE_HAS_STRING_CLASS // Compiler's template mechanism must see source code (i.e., .C diff --git a/ace/config-osf1-4.0.h b/ace/config-osf1-4.0.h index 8ab712eb3df..2f4d0c8a4cb 100644 --- a/ace/config-osf1-4.0.h +++ b/ace/config-osf1-4.0.h @@ -10,6 +10,11 @@ #if !defined (ACE_CONFIG_H) #define ACE_CONFIG_H +#define ACE_HAS_STRING_CLASS +#define ACE_LACKS_LINEBUFFERED_STREAMBUF +#define ACE_LACKS_SIGNED_CHAR +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS + #if ! defined (__ACE_INLINE__) #define __ACE_INLINE__ #endif /* ! __ACE_INLINE__ */ @@ -19,11 +24,6 @@ // functionality is lost? Platform supports <sys/procfs.h> //#define ACE_HAS_PROC_FS -#define ACE_HAS_STRING_CLASS -#define ACE_LACKS_IOSTREAM_FX -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_SIGNED_CHAR - // Platform defines MAP_FAILED as a long constant. #define ACE_HAS_LONG_MAP_FAILED diff --git a/apps/Gateway/Gateway/Proxy_Handler_Connector.cpp b/apps/Gateway/Gateway/Proxy_Handler_Connector.cpp index 5727f443edf..3b0cee18794 100644 --- a/apps/Gateway/Gateway/Proxy_Handler_Connector.cpp +++ b/apps/Gateway/Gateway/Proxy_Handler_Connector.cpp @@ -65,8 +65,8 @@ Proxy_Handler_Connector::initiate_connection (Proxy_Handler *proxy_handler, if (synch_options[ACE_Synch_Options::USE_REACTOR]) { if (ACE_Service_Config::reactor ()->schedule_timer - (proxy_handler, 0, proxy_handler->timeout ()) == 0) - ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", + (proxy_handler, 0, proxy_handler->timeout ()) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "schedule_timer"), -1); } else diff --git a/examples/Connection/misc/Connection_Handler.cpp b/examples/Connection/misc/Connection_Handler.cpp index 610d642abca..1e047ab451c 100644 --- a/examples/Connection/misc/Connection_Handler.cpp +++ b/examples/Connection/misc/Connection_Handler.cpp @@ -98,11 +98,10 @@ Connection_Handler::svc (void) ACE_ERROR_RETURN ((LM_ERROR, "can' (%P|%t) t register with reactor\n"), -1); // Schedule a timer. - else if (this->reactor ()->schedule_timer - (this, - (const void *) this, - ACE_Time_Value (2), - ACE_Time_Value (2)) == -1) + else if (this->reactor ()->schedule_timer (this, + (const void *) this, + ACE_Time_Value (2), + ACE_Time_Value (2)) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) can't register with reactor\n"), -1); else ACE_DEBUG ((LM_DEBUG, " (%P|%t) connected with client\n")); diff --git a/examples/Logger/Acceptor-server/server_loggerd.cpp b/examples/Logger/Acceptor-server/server_loggerd.cpp index 941b9b8438f..e8308747acc 100644 --- a/examples/Logger/Acceptor-server/server_loggerd.cpp +++ b/examples/Logger/Acceptor-server/server_loggerd.cpp @@ -194,10 +194,10 @@ Logging_Handler::open (void *) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) can't register with reactor\n"), -1); else if (REACTOR::instance ()->schedule_timer - (this, - (const void *) this, - ACE_Time_Value (2), - ACE_Time_Value (2)) == -1) + (this, + (const void *) this, + ACE_Time_Value (2), + ACE_Time_Value (2)) == -1) ACE_ERROR_RETURN ((LM_ERROR, "can'(%P|%t) t register with reactor\n"), -1); else diff --git a/examples/Misc/Makefile b/examples/Misc/Makefile index b156e663eea..47be3e494de 100644 --- a/examples/Misc/Makefile +++ b/examples/Misc/Makefile @@ -12,6 +12,7 @@ BIN = test_dump \ test_get_opt \ test_profile_timer \ test_read_buffer \ + test_set \ test_sstring \ test_trace \ test_XtReactor1 \ diff --git a/examples/Misc/test_XtReactor1.cpp b/examples/Misc/test_XtReactor1.cpp index 6c1647ec4f6..dfbecf2be87 100644 --- a/examples/Misc/test_XtReactor1.cpp +++ b/examples/Misc/test_XtReactor1.cpp @@ -1,9 +1,8 @@ -// The following is another test that exercises the Eric C. Newton's // $Id$ +// The following is another test that exercises the Eric C. Newton's // <ecn@clark.net> XtReactor implementation. - #include "ace/XtReactor.h" #include "ace/Message_Block.h" @@ -119,7 +118,10 @@ main (int argc, char**argv) reactor.register_handler (stdin_, ACE_Event_Handler::READ_MASK); // Print a message every 10 seconds. - reactor.schedule_timer (stdin_, 0, ACE_Time_Value (10), ACE_Time_Value (10)); + if (reactor.schedule_timer (stdin_, 0, + ACE_Time_Value (10), + ACE_Time_Value (10)) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); // Show the top_level widget. XtRealizeWidget (top_level); diff --git a/examples/Misc/test_XtReactor2.cpp b/examples/Misc/test_XtReactor2.cpp index 31fab787b26..87aa062151e 100644 --- a/examples/Misc/test_XtReactor2.cpp +++ b/examples/Misc/test_XtReactor2.cpp @@ -1,9 +1,8 @@ -// The following test exercises the Eric C. Newton's <ecn@clark.net> // $Id$ +// The following test exercises the Eric C. Newton's <ecn@clark.net> // XtReactor implementation. - #include "ace/XtReactor.h" #include "ace/Message_Block.h" @@ -14,29 +13,31 @@ class Stdin : public ACE_Event_Handler { public: - ACE_HANDLE get_handle (void) const { return ACE_STDIN; } + ACE_HANDLE get_handle (void) const { return ACE_STDIN; } - int handle_input (ACE_HANDLE fd) - { - char c; - if (read (0, &c, 1)==1) - printf ("Got input '%d'\n", (int)c); - return 0; - } + int handle_input (ACE_HANDLE fd) + { + char c; + if (read (0, &c, 1)==1) + printf ("Got input '%d'\n", (int)c); + return 0; + } - int handle_timeout (const ACE_Time_Value &tv, const void *arg) - { - printf ("Timeout! %f\n", (double) (tv.msec ()/1000.)); - return 0; - } + int handle_timeout (const ACE_Time_Value &tv, const void *arg) + { + printf ("Timeout! %f\n", (double) (tv.msec ()/1000.)); + return 0; + } }; -void ActivateCB (Widget w, XtPointer, XtPointer) +static void +ActivateCB (Widget w, XtPointer, XtPointer) { - printf ("Button pushed!\n"); + printf ("Button pushed!\n"); } -int main (int argc, char**argv) +int +main (int argc, char**argv) { // The worlds most useless user interface Widget top_level = XtVaAppInitialize (NULL, "buttontest", NULL, 0, @@ -53,7 +54,10 @@ int main (int argc, char**argv) reactor.register_handler (stdin_, ACE_Event_Handler::READ_MASK); // Print a message every 10 seconds - reactor.schedule_timer (stdin_, 0, ACE_Time_Value (10), ACE_Time_Value (10)); + if (reactor.schedule_timer (stdin_, 0, + ACE_Time_Value (10), + ACE_Time_Value (10)) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); // Show the top_level widget XtRealizeWidget (top_level); diff --git a/examples/Misc/test_set.cpp b/examples/Misc/test_set.cpp new file mode 100644 index 00000000000..d6ff912e604 --- /dev/null +++ b/examples/Misc/test_set.cpp @@ -0,0 +1,60 @@ +// $Id$ + +#include "ace/Set.h" + +int +main (int, char *[]) +{ + ACE_Unbounded_Set<int> s1; + + ACE_ASSERT (s1.size () == 0); + s1.insert_tail (10); + s1.insert_tail (20); + ACE_ASSERT (s1.size () == 2); + + ACE_Unbounded_Set<int> s2 (s1); + ACE_ASSERT (s2.size () == 2); + + ACE_Unbounded_Set<int> s3; + ACE_ASSERT (s3.size () == 0); + + s3 = s2; + ACE_ASSERT (s3.size () == s2.size ()); + + ACE_Unbounded_Set<int> s4 (s3); + ACE_ASSERT (s4.size () == 2); + + int *ip = 0; + + ACE_DEBUG ((LM_DEBUG, "dumping s1\n")); + for (ACE_Unbounded_Set_Iterator<int> iter1 (s1); + iter1.next (ip) != 0; + iter1.advance ()) + ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip)); + + ACE_DEBUG ((LM_DEBUG, "dumping s2\n")); + for (ACE_Unbounded_Set_Iterator<int> iter2 (s2); + iter2.next (ip) != 0; + iter2.advance ()) + ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip)); + + ACE_DEBUG ((LM_DEBUG, "dumping s3\n")); + for (ACE_Unbounded_Set_Iterator<int> iter3 (s3); + iter3.next (ip) != 0; + iter3.advance ()) + ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip)); + + ACE_DEBUG ((LM_DEBUG, "dumping s4\n")); + for (ACE_Unbounded_Set_Iterator<int> iter4 (s4); + iter4.next (ip) != 0; + iter4.advance ()) + ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip)); + + return 0; +} + +#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +template class ACE_Unbounded_Set<int>; +template class ACE_Unbounded_Set_Iterator<int>; +template class ACE_Set_Node<int>; +#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ diff --git a/examples/Reactor/Misc/test_signals_1.cpp b/examples/Reactor/Misc/test_signals_1.cpp index faaf1941661..99964162267 100644 --- a/examples/Reactor/Misc/test_signals_1.cpp +++ b/examples/Reactor/Misc/test_signals_1.cpp @@ -70,7 +70,8 @@ main (int, char *argv[]) // This just executes the reactor events until my_handler tells us // we are finished. - ACE_DEBUG ((LM_DEBUG, "starting event loop that runs until you've typed ^C a total of 10 times or ^\\ once.\n")); + ACE_DEBUG ((LM_DEBUG, + "starting event loop that runs until you've typed ^C a total of 10 times or ^\\ once.\n")); int result = my_config.run_reactor_event_loop (); diff --git a/examples/Reactor/Multicast/server.cpp b/examples/Reactor/Multicast/server.cpp index 473e92bcb42..6395fe5f2ef 100644 --- a/examples/Reactor/Multicast/server.cpp +++ b/examples/Reactor/Multicast/server.cpp @@ -165,10 +165,11 @@ Server_Events::handle_input (ACE_HANDLE) if (this->initialized_ == 0) { // Restart the timer since we've received events again. - reactor()->schedule_timer (this, - (void *) this->hostname_, - ACE_Time_Value::zero, - ACE_Time_Value (DURATION)); + if (reactor()->schedule_timer (this, + (void *) this->hostname_, + ACE_Time_Value::zero, + ACE_Time_Value (DURATION)) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); this->initialized_ = 1; } diff --git a/examples/Reactor/Proactor/test_multiple_loops.cpp b/examples/Reactor/Proactor/test_multiple_loops.cpp index 225bbe63122..0cc51f9e511 100644 --- a/examples/Reactor/Proactor/test_multiple_loops.cpp +++ b/examples/Reactor/Proactor/test_multiple_loops.cpp @@ -79,7 +79,7 @@ public: }; int -main () +main (void) { Timeout_Handler handler; ACE_Proactor proactor (0, 0, 1); @@ -88,18 +88,22 @@ main () // Register a 2 second timer. ACE_Time_Value foo_tv (2); - proactor.schedule_timer (handler, - (void *) "Proactor", - ACE_Time_Value::zero, - foo_tv); + if (proactor.schedule_timer (handler, + (void *) "Proactor", + ACE_Time_Value::zero, + foo_tv) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); // Register a 3 second timer. ACE_Time_Value bar_tv (3); - ACE_Service_Config::reactorEx ()->schedule_timer (&handler, - (void *) "ReactorEx", - ACE_Time_Value::zero, - bar_tv); + if (ACE_Service_Config::reactorEx ()->schedule_timer (&handler, + (void *) "ReactorEx", + ACE_Time_Value::zero, + bar_tv) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); + Worker worker; + if (worker.activate (THR_NEW_LWP, 10) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1); diff --git a/examples/Reactor/Proactor/test_timeout.cpp b/examples/Reactor/Proactor/test_timeout.cpp index 35aa831d4b7..0346b8052e2 100644 --- a/examples/Reactor/Proactor/test_timeout.cpp +++ b/examples/Reactor/Proactor/test_timeout.cpp @@ -66,24 +66,28 @@ public: }; int -main () +main (void) { Timeout_Handler handler; // Register a 2 second timer. ACE_Time_Value foo_tv (2); - ACE_Service_Config::proactor ()->schedule_timer (handler, - (void *) "Foo", - ACE_Time_Value::zero, - foo_tv); + if (ACE_Service_Config::proactor ()->schedule_timer (handler, + (void *) "Foo", + ACE_Time_Value::zero, + foo_tv) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); + // Register a 3 second timer. ACE_Time_Value bar_tv (3); - ACE_Service_Config::proactor ()->schedule_timer (handler, - (void *) "Bar", - ACE_Time_Value::zero, - bar_tv); + if (ACE_Service_Config::proactor ()->schedule_timer (handler, + (void *) "Bar", + ACE_Time_Value::zero, + bar_tv) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); Worker worker; + if (worker.activate (THR_NEW_LWP, 10) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1); diff --git a/examples/Reactor/ReactorEx/test_MT.cpp b/examples/Reactor/ReactorEx/test_MT.cpp index 3d124dcb255..5224d30ffaa 100644 --- a/examples/Reactor/ReactorEx/test_MT.cpp +++ b/examples/Reactor/ReactorEx/test_MT.cpp @@ -208,23 +208,25 @@ main (int argc, char **argv) ACE_DEBUG ((LM_DEBUG, "********************************************************\n")); // Setup a timer for the task - ACE_Service_Config::reactorEx ()->schedule_timer (&task, - (void *) i, - 0); + if (ACE_Service_Config::reactorEx ()->schedule_timer (&task, + (void *) i, + 0) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); for (int i = 0; i < number_of_handles_to_signal; i++) - { - // Randomly select a handle to signal. - task.signal (ACE_OS::rand() % number_of_handles); - } + // Randomly select a handle to signal. + task.signal (ACE_OS::rand() % number_of_handles); } // Sleep for a while ACE_OS::sleep (interval); + // Close ReactorEx ACE_Service_Config::reactorEx ()->close (); + // Wait for all threads to exit ACE_Service_Config::thr_mgr ()->wait (); + // Delete dynamic resources ACE_Service_Config::close_singletons (); diff --git a/examples/Reactor/ReactorEx/test_timeout.cpp b/examples/Reactor/ReactorEx/test_timeout.cpp index 66656b13ac3..8a8687b50d6 100644 --- a/examples/Reactor/ReactorEx/test_timeout.cpp +++ b/examples/Reactor/ReactorEx/test_timeout.cpp @@ -28,13 +28,15 @@ class Timeout_Handler : public ACE_Event_Handler // Generic timeout handler. { public: - Timeout_Handler (void) : count_ (0) {;} + Timeout_Handler (void) + : count_ (0) {} virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg) // Print out when timeouts occur. { - ACE_DEBUG ((LM_DEBUG, "%d timeout occurred for %s.\n", + ACE_DEBUG ((LM_DEBUG, + "%d timeout occurred for %s.\n", ++count_, (char *) arg)); return 0; @@ -45,7 +47,7 @@ private: }; int -main () +main (void) { Timeout_Handler handler; diff --git a/examples/Reactor/WFMO_Reactor/test_MT.cpp b/examples/Reactor/WFMO_Reactor/test_MT.cpp index 3d124dcb255..5224d30ffaa 100644 --- a/examples/Reactor/WFMO_Reactor/test_MT.cpp +++ b/examples/Reactor/WFMO_Reactor/test_MT.cpp @@ -208,23 +208,25 @@ main (int argc, char **argv) ACE_DEBUG ((LM_DEBUG, "********************************************************\n")); // Setup a timer for the task - ACE_Service_Config::reactorEx ()->schedule_timer (&task, - (void *) i, - 0); + if (ACE_Service_Config::reactorEx ()->schedule_timer (&task, + (void *) i, + 0) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); for (int i = 0; i < number_of_handles_to_signal; i++) - { - // Randomly select a handle to signal. - task.signal (ACE_OS::rand() % number_of_handles); - } + // Randomly select a handle to signal. + task.signal (ACE_OS::rand() % number_of_handles); } // Sleep for a while ACE_OS::sleep (interval); + // Close ReactorEx ACE_Service_Config::reactorEx ()->close (); + // Wait for all threads to exit ACE_Service_Config::thr_mgr ()->wait (); + // Delete dynamic resources ACE_Service_Config::close_singletons (); diff --git a/examples/Reactor/WFMO_Reactor/test_timeout.cpp b/examples/Reactor/WFMO_Reactor/test_timeout.cpp index 66656b13ac3..8a8687b50d6 100644 --- a/examples/Reactor/WFMO_Reactor/test_timeout.cpp +++ b/examples/Reactor/WFMO_Reactor/test_timeout.cpp @@ -28,13 +28,15 @@ class Timeout_Handler : public ACE_Event_Handler // Generic timeout handler. { public: - Timeout_Handler (void) : count_ (0) {;} + Timeout_Handler (void) + : count_ (0) {} virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg) // Print out when timeouts occur. { - ACE_DEBUG ((LM_DEBUG, "%d timeout occurred for %s.\n", + ACE_DEBUG ((LM_DEBUG, + "%d timeout occurred for %s.\n", ++count_, (char *) arg)); return 0; @@ -45,7 +47,7 @@ private: }; int -main () +main (void) { Timeout_Handler handler; diff --git a/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.i b/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.i index 50cd399cae2..0b894b35926 100644 --- a/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.i +++ b/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.i @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - #include "ace/Service_Config.h" #include "ace/Get_Opt.h" @@ -48,7 +47,13 @@ Handle_Timeout::init (int argc, char *argv[]) break; } - return ACE_Service_Config::reactor ()->schedule_timer (this, (void *) arg, delta, interval); + if (ACE_Service_Config::reactor ()->schedule_timer (this, + (void *) arg, + delta, + interval) == -1) + return -1; + else + return 0; } ACE_INLINE int @@ -64,11 +69,14 @@ Handle_Timeout::get_handle (void) const } ACE_INLINE int -Handle_Timeout::handle_timeout (const ACE_Time_Value &tv, const void *arg) +Handle_Timeout::handle_timeout (const ACE_Time_Value &tv, + const void *arg) { if (this->count++ >= 10) - return -1; /* Automatically cancel periodic timer... */ - ACE_DEBUG ((LM_INFO, "time for this(%u) expired at (%d, %d) with arg = %d\n", + return -1; // Automatically cancel periodic timer... + + ACE_DEBUG ((LM_INFO, + "time for this(%u) expired at (%d, %d) with arg = %d\n", this, tv.sec (), tv.usec (), int (arg))); return 0; } diff --git a/examples/Service_Configurator/Misc/Timer_Service.cpp b/examples/Service_Configurator/Misc/Timer_Service.cpp index cd045a28108..c4798a2f4e4 100644 --- a/examples/Service_Configurator/Misc/Timer_Service.cpp +++ b/examples/Service_Configurator/Misc/Timer_Service.cpp @@ -46,8 +46,11 @@ Timer_Service::init (int argc, char *argv[]) // Register the timer to go off in 1 second, and then to go off // every <interval> seconds. - return ACE_Service_Config::reactor ()->schedule_timer - (this, 0, ACE_Time_Value (1), ACE_Time_Value (interval)); + if (ACE_Service_Config::reactor ()->schedule_timer + (this, 0, ACE_Time_Value (1), ACE_Time_Value (interval)) == -1) + return -1; + else + return 0; } int diff --git a/include/makeinclude/platform_osf1_4.0.GNU b/include/makeinclude/platform_osf1_4.0.GNU index ebfe1bec164..4e637cbc910 100644 --- a/include/makeinclude/platform_osf1_4.0.GNU +++ b/include/makeinclude/platform_osf1_4.0.GNU @@ -2,12 +2,12 @@ CC = cxx CXX = $(CC) -CFLAGS += $(DCFLAGS) -pthread -ptr $(WRAPPER_ROOT)/ace/cxx_repository +CFLAGS += $(DCFLAGS) -pthread -ptr ptrepository CCFLAGS += $(CFLAGS) -w0 DCFLAGS += -g DLD = $(CXX) LD = $(CXX) -LIBS += -pthread -ltli -lrt +LIBS += -pthread -ltli -lrt -ptr ptrepository PIC = ARFLAGS = ruvZ # When libraries are archived, a hash index is automatically created so there diff --git a/netsvcs/lib/TS_Clerk_Handler.cpp b/netsvcs/lib/TS_Clerk_Handler.cpp index f6d8c5b3b66..a526b49324d 100644 --- a/netsvcs/lib/TS_Clerk_Handler.cpp +++ b/netsvcs/lib/TS_Clerk_Handler.cpp @@ -496,7 +496,7 @@ ACE_TS_Clerk_Processor::initiate_connection (ACE_TS_Clerk_Handler *handler, { if (ACE_Service_Config::reactor ()->schedule_timer (handler, 0, - handler->timeout ()) == 0) + handler->timeout ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "schedule_timer"), -1); } else diff --git a/netsvcs/lib/TS_Clerk_Handler.h b/netsvcs/lib/TS_Clerk_Handler.h index fe0e025303a..096266bd0d2 100644 --- a/netsvcs/lib/TS_Clerk_Handler.h +++ b/netsvcs/lib/TS_Clerk_Handler.h @@ -208,7 +208,7 @@ private: System_Time system_time_; // Clerk system time containing pointers to entries in shared memory - int timer_id_; + long timer_id_; // Timer id returned by Reactor int timeout_; diff --git a/netsvcs/lib/Token_Handler.h b/netsvcs/lib/Token_Handler.h index a9279ad9ba2..ff2812f74bb 100644 --- a/netsvcs/lib/Token_Handler.h +++ b/netsvcs/lib/Token_Handler.h @@ -120,7 +120,7 @@ private: ACE_Token_Collection collection_; // collection of the client's token proxies. - int timeout_id_; + long timeout_id_; // ID returned by the Reactor that is used to kill registered timers // when a token operation times out. diff --git a/tests/IOStream_Test.cpp b/tests/IOStream_Test.cpp index ef34ca85c35..642a9312d17 100644 --- a/tests/IOStream_Test.cpp +++ b/tests/IOStream_Test.cpp @@ -98,7 +98,9 @@ operator>> (ACE_SOCK_IOStream & stream, qchar *buf) *buf = '\0'; // Initialize the string - if (!(stream >> c)) // eat space up to the first char + stream >> c; + + if (!stream) // eat space up to the first char return stream; // if we don't have a quote, append until we see space @@ -192,11 +194,17 @@ client (void *arg = 0) // iostream will pull them out by using the whitespace provided by // the server. - int i; - float f1, f2; - long l; - double d; - server >> i >> f1 >> l >> f2 >> d; + ACE_DEBUG ((LM_DEBUG, "(%P|%t) Client Receiving\n")); + + int i; + float f1, f2; + long l; + double d; + server >> i; + server >> f1; + server >> l; + server >> f2; + server >> d; ACE_DEBUG ((LM_DEBUG, "(%P|%t) Client Received: int %d float %f long %d float %f double %f\n", |