summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1997-01-23 05:11:18 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1997-01-23 05:11:18 +0000
commitba7a2bbd8794d80f4b096f73fcd5b4336a73e401 (patch)
tree2e84c7253f4dd22e1ad3d6a0c3d9bb6e57e283ad /ace
parent457a6992c781a238fe7a803d8b8da345780ec9bb (diff)
downloadATCD-ba7a2bbd8794d80f4b096f73fcd5b4336a73e401.tar.gz
*** empty log message ***
Diffstat (limited to 'ace')
-rw-r--r--ace/ACE.cpp1
-rw-r--r--ace/Dump_T.h2
-rw-r--r--ace/Local_Name_Space_T.cpp2
-rw-r--r--ace/OS.cpp279
-rw-r--r--ace/OS.h278
-rw-r--r--ace/OS.i164
-rw-r--r--ace/README2
-rw-r--r--ace/Reactor.cpp32
-rw-r--r--ace/Reactor.h7
-rw-r--r--ace/ReactorEx.h2
-rw-r--r--ace/SV_Semaphore_Complex.h2
-rw-r--r--ace/Strategies.h6
-rw-r--r--ace/Synch.cpp1
-rw-r--r--ace/Synch.h8
-rw-r--r--ace/Synch_T.cpp5
-rw-r--r--ace/System_Time.cpp1
-rw-r--r--ace/TLI_Connector.cpp1
-rw-r--r--ace/Thread_Manager.cpp9
-rw-r--r--ace/Time_Value.cpp280
-rw-r--r--ace/Time_Value.h274
-rw-r--r--ace/Time_Value.i166
-rw-r--r--ace/Timer_Heap.h2
-rw-r--r--ace/Timer_List.h2
-rw-r--r--ace/Timer_Queue.h2
-rw-r--r--ace/Token.cpp1
-rw-r--r--ace/config-mvs.h6
-rw-r--r--ace/config-sunos5.5-g++.h1
-rw-r--r--ace/config-sunos5.5-sunc++-4.1.h1
-rw-r--r--ace/config-sunos5.5-sunc++-4.x-orbix.h2
-rw-r--r--ace/config-sunos5.5-sunc++-4.x.h2
-rw-r--r--ace/config-vxworks5.2-g++.h1
-rw-r--r--ace/config-win32-msvc2.0.h2
-rw-r--r--ace/config-win32-msvc4.x.h2
-rw-r--r--ace/config-winnt-4.0-msvc4.x.h2
34 files changed, 789 insertions, 759 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index 4ab28a442ee..6fee653c20c 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -3,7 +3,6 @@
#define ACE_BUILD_DLL
#include "ace/IPC_SAP.h"
-#include "ace/Time_Value.h"
#include "ace/Handle_Set.h"
#include "ace/ACE.h"
#include "ace/Thread_Manager.h"
diff --git a/ace/Dump_T.h b/ace/Dump_T.h
index f1031796341..d2ee0a62886 100644
--- a/ace/Dump_T.h
+++ b/ace/Dump_T.h
@@ -22,7 +22,7 @@
template <class Concrete>
class ACE_Dumpable_Adapter : public ACE_Dumpable
- // = TITLE
+ // = TITLE
// This class inherits the interface of the abstract ACE_Dumpable
// class and is instantiated with the implementation of the
// concrete component class <class Concrete>.
diff --git a/ace/Local_Name_Space_T.cpp b/ace/Local_Name_Space_T.cpp
index 821ee3797d6..8478c390fe8 100644
--- a/ace/Local_Name_Space_T.cpp
+++ b/ace/Local_Name_Space_T.cpp
@@ -83,7 +83,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::remap (EXCEPTION_POINTERS *ep)
// ACE_MMap_Memory_Pool.
if (this->allocator_->alloc ().memory_pool ().remap (addr) == -1)
// Kick it upstairs...
- return (DWORD) EXCEPTION_CONTINUE_SEARCH;
+ return (DWORD) EXCEPTION_CONTINUE_SEARCH;
#if __X86__
// This is 80x86-specific.
diff --git a/ace/OS.cpp b/ace/OS.cpp
index 3eed6a64a64..d60624f2b34 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -14,6 +14,275 @@
#include "ace/OS.i"
#endif /* ACE_HAS_INLINED_OS_CALLS */
+// Static constant representing `zero-time'.
+const ACE_Time_Value ACE_Time_Value::zero;
+
+ACE_ALLOC_HOOK_DEFINE(ACE_Time_Value)
+
+// Initializes the ACE_Time_Value object from a timeval.
+
+ACE_Time_Value::ACE_Time_Value (const timeval &tv)
+{
+ // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value");
+ this->set (tv);
+}
+
+#if defined(ACE_WIN32)
+// Initializes the ACE_Time_Value object from a Win32 FILETIME
+
+ACE_Time_Value::ACE_Time_Value (const FILETIME &file_time)
+{
+ // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value");
+ this->set (file_time);
+}
+
+void ACE_Time_Value::set (const FILETIME &file_time)
+{
+ // Initializes the ACE_Time_Value object from a Win32 FILETIME
+ ACE_QWORD _100ns = ACE_MAKE_QWORD (file_time.dwLowDateTime,
+ file_time.dwHighDateTime);
+ // Convert 100ns units to seconds;
+ this->tv_sec_ = long (_100ns / (10000 * 1000));
+ // Convert remainder to microseconds;
+ this->tv_usec_ = long ((_100ns - (this->tv_sec_ * (10000 * 1000))) / 10);
+}
+
+// Returns the value of the object as a Win32 FILETIME.
+
+ACE_Time_Value::operator FILETIME () const
+{
+ // ACE_TRACE ("ACE_Time_Value::operator FILETIME");
+ ACE_QWORD _100ns = ((ACE_QWORD) this->tv_sec_ * (1000 * 1000) + this->tv_usec_) * 10;
+ FILETIME file_time;
+ file_time.dwLowDateTime = ACE_LOW_DWORD (_100ns);
+ file_time.dwHighDateTime = ACE_HIGH_DWORD (_100ns);
+ return file_time;
+}
+
+#endif
+
+void
+ACE_Time_Value::dump (void) const
+{
+ // ACE_TRACE ("ACE_Time_Value::dump");
+#if 0
+ if (tv.usec () < 0 || tv.sec () < 0)
+ stream << "-";
+
+ stream << dec << abs (int (tv.sec ())) << "."
+// << setw (6) << setfill ('0')
+ << dec << abs (int (tv.usec ()));
+// I assume
+ inline int abs(int d) { return (d>0)?d:-d; }
+ is defined somewhere */
+#endif /* 0 */
+}
+
+void
+ACE_Time_Value::set (long sec, long usec)
+{
+ // ACE_TRACE ("ACE_Time_Value::set");
+ this->tv_sec_ = sec;
+ this->tv_usec_ = usec;
+}
+
+ACE_Time_Value::ACE_Time_Value (long sec, long usec)
+{
+ // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value");
+ this->set (sec, usec);
+ this->normalize ();
+}
+
+// Returns the value of the object as a timeval.
+
+ACE_Time_Value::operator timeval () const
+{
+ // ACE_TRACE ("ACE_Time_Value::operator timeval");
+ timeval tv;
+ tv.tv_sec = this->tv_sec_;
+ tv.tv_usec = this->tv_usec_;
+ return tv;
+}
+
+// Add TV to this.
+
+void
+ACE_Time_Value::operator+= (const ACE_Time_Value &tv)
+{
+ // ACE_TRACE ("ACE_Time_Value::operator+=");
+ this->tv_sec_ += tv.tv_sec_;
+ this->tv_usec_ += tv.tv_usec_;
+ this->normalize ();
+}
+
+// Subtract TV to this.
+
+void
+ACE_Time_Value::operator-= (const ACE_Time_Value &tv)
+{
+ // ACE_TRACE ("ACE_Time_Value::operator-=");
+ this->tv_sec_ -= tv.tv_sec_;
+ this->tv_usec_ -= tv.tv_usec_;
+ this->normalize ();
+}
+
+// Adds two ACE_Time_Value objects together, returns the sum.
+
+ACE_Time_Value
+operator + (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
+{
+ // ACE_TRACE ("operator +");
+ ACE_Time_Value sum (tv1.tv_sec_ + tv2.tv_sec_,
+ tv1.tv_usec_ + tv2.tv_usec_);
+
+ sum.normalize ();
+ return sum;
+}
+
+// Subtracts two ACE_Time_Value objects, returns the difference.
+
+ACE_Time_Value
+operator - (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
+{
+ // ACE_TRACE ("operator -");
+ ACE_Time_Value delta (tv1.tv_sec_ - tv2.tv_sec_,
+ tv1.tv_usec_ - tv2.tv_usec_);
+ delta.normalize ();
+ return delta;
+}
+
+// True if tv1 > tv2.
+
+int
+operator > (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
+{
+ // ACE_TRACE ("operator >");
+ if (tv1.tv_sec_ > tv2.tv_sec_)
+ return 1;
+ else if (tv1.tv_sec_ == tv2.tv_sec_
+ && tv1.tv_usec_ > tv2.tv_usec_)
+ return 1;
+ else
+ return 0;
+}
+
+// True if tv1 >= tv2.
+
+int
+operator >= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
+{
+ // ACE_TRACE ("operator >=");
+ if (tv1.tv_sec_ > tv2.tv_sec_)
+ return 1;
+ else if (tv1.tv_sec_ == tv2.tv_sec_
+ && tv1.tv_usec_ >= tv2.tv_usec_)
+ return 1;
+ else
+ return 0;
+}
+
+void
+ACE_Time_Value::normalize (void)
+{
+ // ACE_TRACE ("ACE_Time_Value::normalize");
+ // New code from Hans Rohnert...
+
+ if (this->tv_usec_ >= ONE_SECOND)
+ {
+ do
+ {
+ this->tv_sec_++;
+ this->tv_usec_ -= ONE_SECOND;
+ }
+ while (this->tv_usec_ >= ONE_SECOND);
+ }
+ else if (this->tv_usec_ <= -ONE_SECOND)
+ {
+ do
+ {
+ this->tv_sec_--;
+ this->tv_usec_ += ONE_SECOND;
+ }
+ while (this->tv_usec_ <= -ONE_SECOND);
+ }
+
+ if (this->tv_sec_ >= 1 && this->tv_usec_ < 0)
+ {
+ this->tv_sec_--;
+ this->tv_usec_ += ONE_SECOND;
+ }
+ else if (this->tv_sec_ < 0 && this->tv_usec_ > 0)
+ {
+ this->tv_sec_++;
+ this->tv_usec_ -= ONE_SECOND;
+ }
+
+#if 0
+ // Old code...
+ while ((this->tv_usec_ >= ONE_SECOND)
+ || (this->tv_sec_ < 0 && this->tv_usec_ > 0 ))
+ {
+ this->tv_usec_ -= ONE_SECOND;
+ this->tv_sec_++;
+ }
+
+ while ((this->tv_usec_ <= -ONE_SECOND)
+ || (this->tv_sec_ > 0 && this->tv_usec_ < 0))
+ {
+ this->tv_usec_ += ONE_SECOND;
+ this->tv_sec_--;
+ }
+#endif
+}
+
+int
+ACE_Countdown_Time::start (void)
+{
+ this->start_time_ = ACE_OS::gettimeofday ();
+ this->stopped_ = 0;
+ return 0;
+}
+
+int
+ACE_Countdown_Time::update (void)
+{
+ return (this->stop () == 0) && this->start ();
+}
+
+int
+ACE_Countdown_Time::stop (void)
+{
+ if (this->max_wait_time_ != 0 && this->stopped_ == 0)
+ {
+ ACE_Time_Value elapsed_time =
+ ACE_OS::gettimeofday () - this->start_time_;
+
+ if (*this->max_wait_time_ > elapsed_time)
+ *this->max_wait_time_ -= elapsed_time;
+ else
+ {
+ // Used all of timeout.
+ *this->max_wait_time_ = ACE_Time_Value::zero;
+ errno = ETIME;
+ }
+ this->stopped_ = 1;
+ }
+ return 0;
+}
+
+ACE_Countdown_Time::ACE_Countdown_Time (ACE_Time_Value *max_wait_time)
+ : max_wait_time_ (max_wait_time),
+ stopped_ (0)
+{
+ if (max_wait_time != 0)
+ this->start ();
+}
+
+ACE_Countdown_Time::~ACE_Countdown_Time (void)
+{
+ this->stop ();
+}
+
#if defined(ACE_MT_SAFE) && defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
int ACE_OS::netdb_mutex_inited_ = 0;
@@ -1543,9 +1812,11 @@ ACE_OS::socket_fini (void)
return 0;
}
-#if defined (VXWORKS)
+#if defined (ACE_LACKS_SYS_NERR)
int sys_nerr = ERRMAX + 1;
+#endif /* ACE_LACKS_SYS_NERR */
+#if defined (VXWORKS)
#include /**/ <usrLib.h> /* for ::sp() */
// This global function can be used from the VxWorks shell to pass
@@ -1659,12 +1930,12 @@ ACE_Thread_ID::handle (ACE_hthread_t thread_handle)
int
ACE_Thread_ID::operator == (const ACE_Thread_ID &rhs)
{
- return this->thread_handle_ == rhs.thread_handle_
- && this->thread_id_ == rhs.thread_id_;
+ return ACE_OS::thr_cmp (this->thread_handle_, rhs.thread_handle_) == 0
+ && ACE_OS::thr_equal (this->thread_id_, rhs.thread_id_) == 0;
}
int
ACE_Thread_ID::operator != (const ACE_Thread_ID &rhs)
{
- return !((*this) == rhs);
+ return !(*this == rhs);
}
diff --git a/ace/OS.h b/ace/OS.h
index e9aedf2b0b6..52bc07399dd 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -128,9 +128,6 @@
#define ACE_DB(X) X
#endif /* ACE_NDEBUG */
-// 10 millisecond fudge factor to account for Solaris timers...
-#define ACE_TIMER_SKEW 1000 * 10
-
// Increase the range of "address families".
#define AF_SPIPE (AF_MAX + 1)
#define AF_FILE (AF_MAX + 2)
@@ -193,7 +190,278 @@ typedef int key_t;
#include /**/ <vxWorks.h>
#endif /* VXWORKS */
-#include "ace/Time_Value.h"
+// This file should be a link to the platform/compiler-specific
+// configuration file (e.g., config-sunos5-sunc++-4.x.h).
+#include "ace/config.h"
+
+#if defined (__ACE_INLINE__)
+#define ACE_INLINE inline
+#else
+#define ACE_INLINE
+#endif /* __ACE_INLINE__ */
+
+// 10 millisecond fudge factor to account for Solaris timers...
+#if !defined (ACE_TIMER_SKEW)
+#define ACE_TIMER_SKEW 1000 * 10
+#endif /* ACE_TIMER_SKEW */
+
+// Nasty macro stuff to account for Microsoft Win32 DLL nonsense. We
+// use these macros so that we don't end up with ACE software
+// hard-coded to Microsoft proprietary extensions to C++.
+
+#if defined (ACE_HAS_DLL)
+#if defined (ACE_BUILD_DLL)
+#if !defined (_MSC_VER) /* Mark classes as exported, Borland. */
+#define ACE_Export _export
+#else /* Microsoft: */
+#define ACE_Export __declspec (dllexport)
+#endif /* !_MSC_VER */
+#else /* Using the DLL. */
+#if !defined _MSC_VER
+#define ACE_Export _import
+#else
+#define ACE_Export __declspec (dllimport)
+#endif /* !_MSC_VER */
+#endif /* ACE_BUILD_DLL */
+
+#else /* We're not building a DLL! */
+#define ACE_Export
+#endif /* ACE_HAS_DLL */
+
+#if defined (ACE_HAS_DLL)
+#if defined (ACE_BUILD_SVC_DLL)
+#if !defined (_MSC_VER) /* Mark classes as exported, Borland. */
+#define ACE_Svc_Export _export
+#else /* Microsoft: */
+#define ACE_Svc_Export __declspec (dllexport)
+#endif /* !_MSC_VER */
+#else /* Using the DLL. */
+#if !defined _MSC_VER
+#define ACE_Svc_Export _import
+#else
+#define ACE_Svc_Export __declspec (dllimport)
+#endif /* !_MSC_VER */
+#endif /* ACE_BUILD_DLL || ACE_BUILD_SVC_DLL */
+
+#else /* We're not building a DLL! */
+#define ACE_Svc_Export
+#endif /* ACE_HAS_DLL */
+
+// This needs to go here *first* to avoid problems with AIX.
+// Just to be safe we'll do it with pthreads, too -- jwr
+#if defined (ACE_HAS_DCETHREADS) || defined (ACE_HAS_PTHREADS)
+extern "C" {
+#include /**/ <pthread.h>
+#if defined (DIGITAL_UNIX)
+#define pthread_self __pthread_self
+extern "C" pthread_t pthread_self (void);
+#endif /* DIGITAL_UNIX */
+}
+#endif /* ACE_HAS_DCETHREADS */
+
+#if (ACE_NTRACE == 1)
+#define ACE_TRACE(X)
+#else
+#define ACE_TRACE(X) ACE_Trace ____ (X, __LINE__, __FILE__)
+#endif /* ACE_NTRACE */
+
+#include /**/ <time.h>
+#if defined (ACE_NEEDS_SYSTIME_H)
+// Some platforms may need to include this, but I suspect that most
+// will get it from <time.h>
+#if defined (VXWORKS)
+#include /**/ <sys/times.h>
+#else
+#include /**/ <sys/time.h>
+#endif /* VXWORKS */
+#endif /* ACE_NEEDS_SYSTIME_H */
+
+#if !defined (ACE_HAS_POSIX_TIME)
+// Definition per POSIX.
+typedef struct timespec
+{
+ time_t tv_sec; // Seconds
+ long tv_nsec; // Nanoseconds
+} timespec_t;
+#elif defined (ACE_HAS_BROKEN_POSIX_TIME)
+// OSF/1 defines struct timespec in <sys/timers.h> - Tom Marrs
+#include /**/ <sys/timers.h>
+#endif /* ACE_HAS_POSIX_TIME */
+
+// #if (!defined (timespec) && !defined (m88k))
+// #define timestruc_t struct timespec
+// #endif /* timespec */
+
+#if !defined (ACE_HAS_SVR4_TIME)
+// Definition per SVr4.
+typedef struct timespec timestruc_t;
+#endif /* ACE_HAS_SVR4_TIME */
+
+class ACE_Export ACE_Time_Value
+ // = TITLE
+ // Operations on "timeval" structures.
+ //
+ // = DESCRIPTION
+ // This class centralizes all the time-related processing in
+ // ACE. These timers are typically used in conjunction with
+ // lower-level OS mechanisms like select(), poll(), or
+ // cond_timedwait(). ACE_Time_Value help make the use of these
+ // mechanisms portable across OS platforms,
+{
+public:
+ // = Useful constants.
+ static const ACE_Time_Value zero;
+ // Constant "0".
+
+ // = Initialization method.
+ ACE_Time_Value (long sec = 0, long usec = 0);
+ // Default constructor.
+
+ // = Methods for converting to/from various time formats.
+ ACE_Time_Value (const struct timeval &t);
+ // Construct a Time_Value from a timeval.
+
+ ACE_Time_Value (const timestruc_t &t);
+ // Initializes the ACE_Time_Value object from a timestruc_t.
+
+ ACE_Time_Value (const ACE_Time_Value &tv);
+ // Copy constructor.
+
+#if defined(ACE_WIN32)
+ ACE_Time_Value (const FILETIME &ft);
+ // Initializes the ACE_Time_Value object from a Win32 FILETIME
+#endif
+
+ void set (long sec = 0, long usec = 0);
+ // Construct a Time_Value from a timeval.
+
+ void set (const timeval &t);
+ // Construct a Time_Value from a timeval.
+
+ void set (const timestruc_t &t);
+ // Initializes the ACE_Time_Value object from a timestruc_t.
+
+#if defined(ACE_WIN32)
+ void set (const FILETIME &ft);
+ // Initializes the ACE_Time_Value object from a timestruc_t.
+#endif
+
+ long msec (void) const;
+ // Converts from Time_Value format into milli-seconds format.
+
+ void msec (long);
+ // Converts from milli-seconds format into Time_Value format.
+
+ operator timestruc_t () const;
+ // Returns the value of the object as a timestruc_t.
+
+ operator timeval () const;
+ // Returns the value of the object as a timeval.
+
+#if defined(ACE_WIN32)
+ operator FILETIME () const;
+ // Returns the value of the object as a Win32 FILETIME.
+#endif
+
+ // = The following are accessor/mutator methods.
+
+ long sec (void) const;
+ // Get seconds.
+
+ void sec (long sec);
+ // Set seconds.
+
+ long usec (void) const;
+ // Get microseconds.
+
+ void usec (long usec);
+ // Set microseconds.
+
+ // = The following are arithmetic methods for operating on
+ // Time_Values.
+
+ void operator += (const ACE_Time_Value &tv);
+ // Add <tv> to this.
+
+ void operator -= (const ACE_Time_Value &tv);
+ // Subtract <tv> to this.
+
+ friend ACE_Export ACE_Time_Value operator + (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
+ // Adds two ACE_Time_Value objects together, returns the sum.
+
+ friend ACE_Export ACE_Time_Value operator - (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
+ // Subtracts two ACE_Time_Value objects, returns the difference.
+
+ friend ACE_Export int operator < (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
+ // True if tv1 < tv2.
+
+ friend ACE_Export int operator > (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
+ // True if tv1 > tv2.
+
+ friend ACE_Export int operator <= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
+ // True if tv1 <= tv2.
+
+ friend ACE_Export int operator >= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
+ // True if tv1 >= tv2.
+
+ friend ACE_Export int operator == (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
+ // True if tv1 == tv2.
+
+ friend ACE_Export int operator != (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
+ // True if tv1 != tv2.
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+private:
+ void normalize (void);
+ // Put the timevalue into a canonical form.
+
+ long tv_sec_;
+ // Seconds.
+
+ long tv_usec_;
+ // Microseconds.
+};
+
+class ACE_Export ACE_Countdown_Time
+ // = TITLE
+ // Keeps track of the amount of elapsed time.
+ //
+ // = DESCRIPTION
+ // This class has a side-effect on the <max_wait_time> -- every
+ // time the <stop> method is called the <max_wait_time> is
+ // updated.
+{
+public:
+ // = Initialization and termination methods.
+ ACE_Countdown_Time (ACE_Time_Value *max_wait_time);
+ // Cache the <max_wait_time> and call <start>.
+
+ ~ACE_Countdown_Time (void);
+ // Call <stop>.
+
+ int start (void);
+ // Cache the current time and enter a start state.
+
+ int stop (void);
+ // Subtract the elapsed time from max_wait_time_ and enter a stopped
+ // state.
+
+ int update (void);
+ // Calls stop and then start. max_wait_time_ is modified by the
+ // call to stop.
+
+private:
+ ACE_Time_Value *max_wait_time_;
+ // Maximum time we were willing to wait.
+
+ ACE_Time_Value start_time_;
+ // Beginning of the start time.
+
+ int stopped_;
+ // Keeps track of whether we've already been stopped.
+};
#if defined (ACE_HAS_USING_KEYWORD)
#define ACE_USING using
@@ -821,7 +1089,7 @@ struct ACE_cond_t
#if defined (ACE_LACKS_RWLOCK_T)
struct ACE_rwlock_t
- // = TITLE
+ // = TITLE
// This is used to implement readers/writer locks on NT,
// VxWorks, and POSIX pthreads.
//
diff --git a/ace/OS.i b/ace/OS.i
index 42a9cc34386..568c0c939a3 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -187,6 +187,166 @@ extern "C" void ace_mutex_lock_cleanup_adapter (void *args);
#define ACE_OSCALL(OP,TYPE,FAILVALUE,RESULT) do { RESULT = (TYPE) OP; } while (0)
#endif /* ACE_HAS_SIGNAL_SAFE_OS_CALLS */
+// Don't put this in the class since it will expand the size! Also,
+// can't make this an enum due to compiler bugs on some platforms...
+static const long ONE_SECOND = 1000000L;
+
+// Initializes the ACE_Time_Value object.
+
+// Initializes a timestruc_t. Note that this approach loses precision
+// since it converts the nano-seconds into micro-seconds. But then
+// again, do any real systems have nano-second timer precision
+// anyway?!
+
+ACE_INLINE void
+ACE_Time_Value::set (const timestruc_t &tv)
+{
+ // ACE_TRACE ("ACE_Time_Value::set");
+ this->tv_sec_ = tv.tv_sec;
+ this->tv_usec_ = tv.tv_nsec / 1000;
+
+ this->normalize ();
+}
+
+// Returns the value of the object as a timestruc_t.
+
+ACE_INLINE
+ACE_Time_Value::operator timestruc_t () const
+{
+ // ACE_TRACE ("ACE_Time_Value::operator timestruc_t");
+ timestruc_t tv;
+ tv.tv_sec = this->tv_sec_;
+ tv.tv_nsec = this->tv_usec_ * 1000;
+ return tv;
+}
+
+// Initializes the ACE_Time_Value object from a timestruc_t.
+
+ACE_INLINE
+ACE_Time_Value::ACE_Time_Value (const timestruc_t &tv)
+{
+ // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value");
+ this->set (tv);
+}
+
+ACE_INLINE void
+ACE_Time_Value::set (const timeval &tv)
+{
+ // ACE_TRACE ("ACE_Time_Value::set");
+ this->tv_sec_ = tv.tv_sec;
+ this->tv_usec_ = tv.tv_usec;
+
+ this->normalize ();
+}
+
+// Initializes the ACE_Time_Value object from another ACE_Time_Value
+
+ACE_INLINE
+ACE_Time_Value::ACE_Time_Value (const ACE_Time_Value &tv)
+ : tv_sec_ (tv.tv_sec_),
+ tv_usec_ (tv.tv_usec_)
+{
+ // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value");
+}
+
+// Returns number of seconds.
+
+ACE_INLINE long
+ACE_Time_Value::sec (void) const
+{
+ // ACE_TRACE ("ACE_Time_Value::sec");
+ return this->tv_sec_;
+}
+
+// Sets the number of seconds.
+
+ACE_INLINE void
+ACE_Time_Value::sec (long sec)
+{
+ // ACE_TRACE ("ACE_Time_Value::sec");
+ this->tv_sec_ = sec;
+}
+
+// Converts from Time_Value format into milli-seconds format.
+
+ACE_INLINE long
+ACE_Time_Value::msec (void) const
+{
+ // ACE_TRACE ("ACE_Time_Value::msec");
+ return this->tv_sec_ * 1000 + this->tv_usec_ / 1000;
+}
+
+// Converts from milli-seconds format into Time_Value format.
+
+ACE_INLINE void
+ACE_Time_Value::msec (long milliseconds)
+{
+ // ACE_TRACE ("ACE_Time_Value::msec");
+ // Convert millisecond units to seconds;
+ this->tv_sec_ = milliseconds / 1000;
+ // Convert remainder to microseconds;
+ this->tv_usec_ = (milliseconds - (this->tv_sec_ * 1000)) * 1000;
+}
+
+// Returns number of micro-seconds.
+
+ACE_INLINE long
+ACE_Time_Value::usec (void) const
+{
+ // ACE_TRACE ("ACE_Time_Value::usec");
+ return this->tv_usec_;
+}
+
+// Sets the number of micro-seconds.
+
+ACE_INLINE void
+ACE_Time_Value::usec (long usec)
+{
+ // ACE_TRACE ("ACE_Time_Value::usec");
+ this->tv_usec_ = usec;
+}
+
+// True if tv1 < tv2.
+
+ACE_INLINE int
+operator < (const ACE_Time_Value &tv1,
+ const ACE_Time_Value &tv2)
+{
+ // ACE_TRACE ("operator <");
+ return tv2 > tv1;
+}
+
+// True if tv1 >= tv2.
+
+ACE_INLINE int
+operator <= (const ACE_Time_Value &tv1,
+ const ACE_Time_Value &tv2)
+{
+ // ACE_TRACE ("operator <=");
+ return tv2 >= tv1;
+}
+
+// True if tv1 == tv2.
+
+ACE_INLINE int
+operator == (const ACE_Time_Value &tv1,
+ const ACE_Time_Value &tv2)
+{
+ // ACE_TRACE ("operator ==");
+ return tv1.tv_sec_ == tv2.tv_sec_
+ && tv1.tv_usec_ == tv2.tv_usec_;
+}
+
+// True if tv1 != tv2.
+
+ACE_INLINE int
+operator != (const ACE_Time_Value &tv1,
+ const ACE_Time_Value &tv2)
+{
+ // ACE_TRACE ("operator !=");
+ return !(tv1 == tv2);
+}
+
ACE_INLINE int
ACE_OS::chdir (const char *path)
{
@@ -3071,7 +3231,7 @@ ACE_OS::sema_post (ACE_sema_t *s)
else
result = 0;
- this->count_++;
+ s->count_++;
ACE_OS::mutex_unlock (&s->lock_);
}
return result;
@@ -3314,9 +3474,9 @@ ACE_OS::thr_getprio (ACE_hthread_t thr_id, int &prio)
return prio == THREAD_PRIORITY_ERROR_RETURN ? -1 : 0;
#elif defined (VXWORKS)
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::taskPriorityGet (thr_id, &prio), ace_result_), int, -1);
-#endif /* ACE_HAS_STHREADS */
#else
ACE_NOTSUP_RETURN (-1);
+#endif /* ACE_HAS_STHREADS */
#endif /* ACE_HAS_THREADS */
}
diff --git a/ace/README b/ace/README
index 398e1f390d8..4811c11eded 100644
--- a/ace/README
+++ b/ace/README
@@ -32,6 +32,7 @@ ACE_HAS_COMPLEX_LOCK Platform supports non-standard readers/writer locks...
ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES Prototypes for both signal() and struct sigaction are consistent.
ACE_HAS_CPLUSPLUS_HEADERS Compiler/platform has correctly prototyped header files
ACE_HAS_DLL Build ACE using the frigging PC DLL nonsense...
+ACE_HAS_EXCEPTIONS Compiler supports C++ exception handling
ACE_HAS_GETPAGESIZE Platform supports getpagesize() call (otherwise, ACE_PAGE_SIZE must be defined, except on Win32)
ACE_HAS_GETRUSAGE Platform supports the getrusage() system call.
ACE_HAS_GNU_CSTRING_H Denotes that GNU has cstring.h as standard which redefines memchr()
@@ -157,6 +158,7 @@ ACE_LACKS_SBRK Platform lacks a working sbrk() (e.g., Win32 and VxWorks)
ACE_LACKS_SEMBUF_T Platform lacks struct sembuf (e.g., Win32 and VxWorks)
ACE_LACKS_SETDETACH Platform lacks pthread_attr_setdetachstate() (e.g., HP/UX 10.x)
ACE_LACKS_SETSCHED Platform lacks pthread_attr_setsched() (e.g. MVS)
+ACE_LACKS_SYS_NERR Platforms/compiler lacks the sys_nerr variable (e.g., VxWorks and MVS).
ACE_LACKS_KEYDELETE Platform lacks TSS keydelete (e.g., HP/UX)
ACE_LACKS_SENDMSG Platform lacks sendmsg() (e.g., Linux)
ACE_LACKS_SI_ADDR Platform lacks the si_addr field of siginfo_t (e.g., VxWorks and HP/UX 10.x)
diff --git a/ace/Reactor.cpp b/ace/Reactor.cpp
index 0a6c982c99d..d00ea8d4307 100644
--- a/ace/Reactor.cpp
+++ b/ace/Reactor.cpp
@@ -1421,6 +1421,17 @@ ACE_Reactor::dispatch (int number_of_active_handles,
}
}
+int
+ACE_Reactor::release_token (void)
+{
+#if defined (ACE_WIN32)
+ this->token_.release ();
+ return (int) EXCEPTION_CONTINUE_SEARCH;
+#else
+ return 0;
+#endif /* ACE_WIN32 */
+}
+
int
ACE_Reactor::handle_events (ACE_Time_Value *max_wait_time)
{
@@ -1441,13 +1452,24 @@ ACE_Reactor::handle_events (ACE_Time_Value *max_wait_time)
countdown.update ();
#endif /* ACE_MT_SAFE */
- ACE_Reactor_Handle_Set dispatch_set;
+ int result;
+
+ ACE_SEH_TRY {
+ ACE_Reactor_Handle_Set dispatch_set;
+
+ int number_of_active_handles =
+ this->wait_for_multiple_events (dispatch_set,
+ max_wait_time);
- int number_of_active_handles =
- this->wait_for_multiple_events (dispatch_set,
- max_wait_time);
+ result = this->dispatch (number_of_active_handles, dispatch_set);
+ }
+ ACE_SEH_EXCEPT (this->release_mutex (this->token_)) {
+ // As it stands now, we catch and then rethrow all Win32
+ // structured exceptions so that we can make sure to release the
+ // <token_> lock correctly.
+ }
- return this->dispatch (number_of_active_handles, dispatch_set);
+ return result;
}
int
diff --git a/ace/Reactor.h b/ace/Reactor.h
index fcafc2d198c..74a593dc841 100644
--- a/ace/Reactor.h
+++ b/ace/Reactor.h
@@ -33,9 +33,9 @@ typedef int (ACE_Event_Handler::*ACE_EH_PTMF) (ACE_HANDLE);
class ACE_Reactor;
class ACE_Export ACE_Reactor_Handle_Set
-{
- // = TITLE
+ // = TITLE
// Track handles we are interested for various events.
+{
public:
ACE_Handle_Set rd_mask_;
// Read events (e.g., input pending, accept pending).
@@ -702,6 +702,9 @@ protected:
friend class ACE_Reactor_Handler_Repository;
private:
+ int release_token (void);
+ // Release the token lock when a Win32 structured exception occurs.
+
// Deny access since member-wise won't work...
ACE_Reactor (const ACE_Reactor &);
ACE_Reactor &operator = (const ACE_Reactor &);
diff --git a/ace/ReactorEx.h b/ace/ReactorEx.h
index 9aacce36118..eb9b4e22312 100644
--- a/ace/ReactorEx.h
+++ b/ace/ReactorEx.h
@@ -37,7 +37,7 @@ typedef ACE_Token ACE_REACTOREX_MUTEX;
class ACE_ReactorEx;
class ACE_Export ACE_ReactorEx_Handle_Set
- // = TITLE
+ // = TITLE
// Track handles we are interested for various events.
{
public:
diff --git a/ace/SV_Semaphore_Complex.h b/ace/SV_Semaphore_Complex.h
index edfd13bf65b..94da59acfda 100644
--- a/ace/SV_Semaphore_Complex.h
+++ b/ace/SV_Semaphore_Complex.h
@@ -20,7 +20,7 @@
#include "ace/SV_Semaphore_Simple.h"
class ACE_Export ACE_SV_Semaphore_Complex : private ACE_SV_Semaphore_Simple
- // = TITLE
+ // = TITLE
// This is a more complex semaphore wrapper that handles race
// conditions for initialization correctly...
//
diff --git a/ace/Strategies.h b/ace/Strategies.h
index 6ef7bae4db0..07fc604be90 100644
--- a/ace/Strategies.h
+++ b/ace/Strategies.h
@@ -48,8 +48,9 @@ protected:
};
class ACE_Export ACE_Reactor_Notification_Strategy : public ACE_Notification_Strategy
- // = TITLE
+ // = TITLE
// Used to notify an ACE_Reactor
+ //
// = DESCRIPTION
// Integrates the ACE_Message_Queue notification into the
// ACE_Reactor::notify() method.
@@ -69,8 +70,9 @@ private:
};
class ACE_Export ACE_ReactorEx_Notification_Strategy : public ACE_Notification_Strategy
- // = TITLE
+ // = TITLE
// Used to notify an ACE_ReactorEx
+ //
// = DESCRIPTION
// Integrates the ACE_Message_Queue notification into the
// ACE_ReactorEx::notify() method.
diff --git a/ace/Synch.cpp b/ace/Synch.cpp
index eb1a2f159e2..2ddf71a61dd 100644
--- a/ace/Synch.cpp
+++ b/ace/Synch.cpp
@@ -7,7 +7,6 @@
#define ACE_BUILD_DLL
#include "ace/Thread.h"
#include "ace/Synch.h"
-#include "ace/Time_Value.h"
#if !defined (__ACE_INLINE__)
#include "ace/Synch.i"
diff --git a/ace/Synch.h b/ace/Synch.h
index 2536ffa110d..a07658ff5c4 100644
--- a/ace/Synch.h
+++ b/ace/Synch.h
@@ -491,7 +491,7 @@ public:
};
class ACE_Null_Barrier
- // = TITLE
+ // = TITLE
// Implements "NULL barrier synchronization".
{
public:
@@ -1063,7 +1063,7 @@ struct ACE_Export ACE_Sub_Barrier
};
class ACE_Export ACE_Barrier
- // = TITLE
+ // = TITLE
// Implements "barrier synchronization".
//
// = DESCRIPTION
@@ -1135,7 +1135,7 @@ public:
#if 0
class ACE_Export ACE_Process_Barrier : public ACE_Barrier
- // = TITLE
+ // = TITLE
// Implements "barrier synchronization" using ACE_Process_Mutexes!
//
// = DESCRIPTION
@@ -1155,7 +1155,7 @@ public:
#endif /* 0 */
class ACE_Export ACE_Thread_Barrier : public ACE_Barrier
- // = TITLE
+ // = TITLE
// Implements "barrier synchronization" using ACE_Thread_Mutexes!
//
// = DESCRIPTION
diff --git a/ace/Synch_T.cpp b/ace/Synch_T.cpp
index 83fa37e38e8..caf70017067 100644
--- a/ace/Synch_T.cpp
+++ b/ace/Synch_T.cpp
@@ -6,7 +6,6 @@
#define ACE_BUILD_DLL
#include "ace/Thread.h"
-#include "ace/Time_Value.h"
#include "ace/Synch_T.h"
#if !defined (__ACE_INLINE__)
@@ -235,6 +234,10 @@ ACE_TSS<TYPE>::dump (void) const
}
#if defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
+#if defined (ACE_HAS_THR_C_DEST)
+extern "C" void ACE_TSS_C_cleanup(void *); // defined in Synch.cpp
+#endif /* ACE_HAS_THR_C_DEST */
+
template <class TYPE> void
ACE_TSS<TYPE>::cleanup (void *ptr)
{
diff --git a/ace/System_Time.cpp b/ace/System_Time.cpp
index 38c9a2f39db..ac2a824b607 100644
--- a/ace/System_Time.cpp
+++ b/ace/System_Time.cpp
@@ -2,7 +2,6 @@
// $Id$
#define ACE_BUILD_DLL
-#include "ace/Time_Value.h"
#include "ace/System_Time.h"
ACE_System_Time::ACE_System_Time (LPCTSTR poolname)
diff --git a/ace/TLI_Connector.cpp b/ace/TLI_Connector.cpp
index f39c6b7c6de..bcf82698ce3 100644
--- a/ace/TLI_Connector.cpp
+++ b/ace/TLI_Connector.cpp
@@ -4,7 +4,6 @@
#define ACE_BUILD_DLL
#include "ace/Handle_Set.h"
#include "ace/TLI_Connector.h"
-#include "ace/Time_Value.h"
#if defined (ACE_HAS_TLI)
diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp
index 39ceaa773e3..fda54832d03 100644
--- a/ace/Thread_Manager.cpp
+++ b/ace/Thread_Manager.cpp
@@ -702,17 +702,16 @@ ACE_Thread_Manager::exit (void *status, int do_thr_exit)
if (do_thr_exit)
{
// Note, destructor is never called, so we must manually release
- // the lock...
+ // the lock... Note that once we release the lock, it marks it
+ // as being "free" so that the Guard's destructor won't try to
+ // release it again.
ACE_MT (ace_mon.release ());
ACE_Thread::exit (status);
// On reasonable systems ACE_Thread::exit() should not return.
// However, due to horrible semantics with Win32 thread-specific
- // storage this call can return (don't ask...). Therefore, we
- // need to reacquire the mutex so that we don't get burned when
- // the Guard automatically releases it when this method returns.
- ACE_MT (ace_mon.acquire ());
+ // storage this call can return (don't ask...).
}
return 0;
}
diff --git a/ace/Time_Value.cpp b/ace/Time_Value.cpp
deleted file mode 100644
index 31127224cc0..00000000000
--- a/ace/Time_Value.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-// Time_Value.cpp
-// $Id$
-
-#define ACE_BUILD_DLL
-#include "ace/ACE.h"
-#include "ace/Time_Value.h"
-
-#if !defined (__ACE_INLINE__)
-#include "ace/Time_Value.i"
-#endif /* __ACE_INLINE__ */
-
-// Static constant representing `zero-time'.
-const ACE_Time_Value ACE_Time_Value::zero;
-
-ACE_ALLOC_HOOK_DEFINE(ACE_Time_Value)
-
-// Initializes the ACE_Time_Value object from a timeval.
-
-ACE_Time_Value::ACE_Time_Value (const timeval &tv)
-{
- // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value");
- this->set (tv);
-}
-
-#if defined(ACE_WIN32)
-// Initializes the ACE_Time_Value object from a Win32 FILETIME
-
-ACE_Time_Value::ACE_Time_Value (const FILETIME &file_time)
-{
- // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value");
- this->set (file_time);
-}
-
-void ACE_Time_Value::set (const FILETIME &file_time)
-{
- // Initializes the ACE_Time_Value object from a Win32 FILETIME
- ACE_QWORD _100ns = ACE_MAKE_QWORD (file_time.dwLowDateTime,
- file_time.dwHighDateTime);
- // Convert 100ns units to seconds;
- this->tv_sec_ = long (_100ns / (10000 * 1000));
- // Convert remainder to microseconds;
- this->tv_usec_ = long ((_100ns - (this->tv_sec_ * (10000 * 1000))) / 10);
-}
-
-// Returns the value of the object as a Win32 FILETIME.
-
-ACE_Time_Value::operator FILETIME () const
-{
- // ACE_TRACE ("ACE_Time_Value::operator FILETIME");
- ACE_QWORD _100ns = ((ACE_QWORD) this->tv_sec_ * (1000 * 1000) + this->tv_usec_) * 10;
- FILETIME file_time;
- file_time.dwLowDateTime = ACE_LOW_DWORD (_100ns);
- file_time.dwHighDateTime = ACE_HIGH_DWORD (_100ns);
- return file_time;
-}
-
-#endif
-
-void
-ACE_Time_Value::dump (void) const
-{
- // ACE_TRACE ("ACE_Time_Value::dump");
-#if 0
- if (tv.usec () < 0 || tv.sec () < 0)
- stream << "-";
-
- stream << dec << abs (int (tv.sec ())) << "."
-// << setw (6) << setfill ('0')
- << dec << abs (int (tv.usec ()));
-// I assume
- inline int abs(int d) { return (d>0)?d:-d; }
- is defined somewhere */
-#endif /* 0 */
-}
-
-void
-ACE_Time_Value::set (long sec, long usec)
-{
- // ACE_TRACE ("ACE_Time_Value::set");
- this->tv_sec_ = sec;
- this->tv_usec_ = usec;
-}
-
-ACE_Time_Value::ACE_Time_Value (long sec, long usec)
-{
- // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value");
- this->set (sec, usec);
- this->normalize ();
-}
-
-// Returns the value of the object as a timeval.
-
-ACE_Time_Value::operator timeval () const
-{
- // ACE_TRACE ("ACE_Time_Value::operator timeval");
- timeval tv;
- tv.tv_sec = this->tv_sec_;
- tv.tv_usec = this->tv_usec_;
- return tv;
-}
-
-// Add TV to this.
-
-void
-ACE_Time_Value::operator+= (const ACE_Time_Value &tv)
-{
- // ACE_TRACE ("ACE_Time_Value::operator+=");
- this->tv_sec_ += tv.tv_sec_;
- this->tv_usec_ += tv.tv_usec_;
- this->normalize ();
-}
-
-// Subtract TV to this.
-
-void
-ACE_Time_Value::operator-= (const ACE_Time_Value &tv)
-{
- // ACE_TRACE ("ACE_Time_Value::operator-=");
- this->tv_sec_ -= tv.tv_sec_;
- this->tv_usec_ -= tv.tv_usec_;
- this->normalize ();
-}
-
-// Adds two ACE_Time_Value objects together, returns the sum.
-
-ACE_Time_Value
-operator + (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
-{
- // ACE_TRACE ("operator +");
- ACE_Time_Value sum (tv1.tv_sec_ + tv2.tv_sec_,
- tv1.tv_usec_ + tv2.tv_usec_);
-
- sum.normalize ();
- return sum;
-}
-
-// Subtracts two ACE_Time_Value objects, returns the difference.
-
-ACE_Time_Value
-operator - (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
-{
- // ACE_TRACE ("operator -");
- ACE_Time_Value delta (tv1.tv_sec_ - tv2.tv_sec_,
- tv1.tv_usec_ - tv2.tv_usec_);
- delta.normalize ();
- return delta;
-}
-
-// True if tv1 > tv2.
-
-int
-operator > (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
-{
- // ACE_TRACE ("operator >");
- if (tv1.tv_sec_ > tv2.tv_sec_)
- return 1;
- else if (tv1.tv_sec_ == tv2.tv_sec_
- && tv1.tv_usec_ > tv2.tv_usec_)
- return 1;
- else
- return 0;
-}
-
-// True if tv1 >= tv2.
-
-int
-operator >= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
-{
- // ACE_TRACE ("operator >=");
- if (tv1.tv_sec_ > tv2.tv_sec_)
- return 1;
- else if (tv1.tv_sec_ == tv2.tv_sec_
- && tv1.tv_usec_ >= tv2.tv_usec_)
- return 1;
- else
- return 0;
-}
-
-void
-ACE_Time_Value::normalize (void)
-{
- // ACE_TRACE ("ACE_Time_Value::normalize");
- // New code from Hans Rohnert...
-
- if (this->tv_usec_ >= ONE_SECOND)
- {
- do
- {
- this->tv_sec_++;
- this->tv_usec_ -= ONE_SECOND;
- }
- while (this->tv_usec_ >= ONE_SECOND);
- }
- else if (this->tv_usec_ <= -ONE_SECOND)
- {
- do
- {
- this->tv_sec_--;
- this->tv_usec_ += ONE_SECOND;
- }
- while (this->tv_usec_ <= -ONE_SECOND);
- }
-
- if (this->tv_sec_ >= 1 && this->tv_usec_ < 0)
- {
- this->tv_sec_--;
- this->tv_usec_ += ONE_SECOND;
- }
- else if (this->tv_sec_ < 0 && this->tv_usec_ > 0)
- {
- this->tv_sec_++;
- this->tv_usec_ -= ONE_SECOND;
- }
-
-#if 0
- // Old code...
- while ((this->tv_usec_ >= ONE_SECOND)
- || (this->tv_sec_ < 0 && this->tv_usec_ > 0 ))
- {
- this->tv_usec_ -= ONE_SECOND;
- this->tv_sec_++;
- }
-
- while ((this->tv_usec_ <= -ONE_SECOND)
- || (this->tv_sec_ > 0 && this->tv_usec_ < 0))
- {
- this->tv_usec_ += ONE_SECOND;
- this->tv_sec_--;
- }
-#endif
-}
-
-int
-ACE_Countdown_Time::start (void)
-{
- this->start_time_ = ACE_OS::gettimeofday ();
- this->stopped_ = 0;
- return 0;
-}
-
-int
-ACE_Countdown_Time::update (void)
-{
- return (this->stop () == 0) && this->start ();
-}
-
-int
-ACE_Countdown_Time::stop (void)
-{
- if (this->max_wait_time_ != 0 && this->stopped_ == 0)
- {
- ACE_Time_Value elapsed_time =
- ACE_OS::gettimeofday () - this->start_time_;
-
- if (*this->max_wait_time_ > elapsed_time)
- *this->max_wait_time_ -= elapsed_time;
- else
- {
- // Used all of timeout.
- *this->max_wait_time_ = ACE_Time_Value::zero;
- errno = ETIME;
- }
- this->stopped_ = 1;
- }
- return 0;
-}
-
-ACE_Countdown_Time::ACE_Countdown_Time (ACE_Time_Value *max_wait_time)
- : max_wait_time_ (max_wait_time),
- stopped_ (0)
-{
- if (max_wait_time != 0)
- this->start ();
-}
-
-ACE_Countdown_Time::~ACE_Countdown_Time (void)
-{
- this->stop ();
-}
-
diff --git a/ace/Time_Value.h b/ace/Time_Value.h
index eba9f0048c0..53a46b9244a 100644
--- a/ace/Time_Value.h
+++ b/ace/Time_Value.h
@@ -17,277 +17,9 @@
#if !defined (ACE_TIME_VALUE_H)
#define ACE_TIME_VALUE_H
-// This file should be a link to the platform/compiler-specific
-// configuration file (e.g., config-sunos5-sunc++-4.x.h). By
-// including this here we avoid nasty circular include problems...
-#include "ace/config.h"
+// This file is no longer used and is only here due to backwards
+// compatibility. All the functionality has been merged into OS.h.
-#if defined (__ACE_INLINE__)
-#define ACE_INLINE inline
-#else
-#define ACE_INLINE
-#endif /* __ACE_INLINE__ */
-
-// Nasty macro stuff to account for Microsoft Win32 DLL nonsense. We
-// use these macros so that we don't end up with ACE software
-// hard-coded to Microsoft proprietary extensions to C++.
-
-#if defined (ACE_HAS_DLL)
-#if defined (ACE_BUILD_DLL)
-#if !defined (_MSC_VER) /* Mark classes as exported, Borland. */
-#define ACE_Export _export
-#else /* Microsoft: */
-#define ACE_Export __declspec (dllexport)
-#endif /* !_MSC_VER */
-#else /* Using the DLL. */
-#if !defined _MSC_VER
-#define ACE_Export _import
-#else
-#define ACE_Export __declspec (dllimport)
-#endif /* !_MSC_VER */
-#endif /* ACE_BUILD_DLL */
-
-#else /* We're not building a DLL! */
-#define ACE_Export
-#endif /* ACE_HAS_DLL */
-
-#if defined (ACE_HAS_DLL)
-#if defined (ACE_BUILD_SVC_DLL)
-#if !defined (_MSC_VER) /* Mark classes as exported, Borland. */
-#define ACE_Svc_Export _export
-#else /* Microsoft: */
-#define ACE_Svc_Export __declspec (dllexport)
-#endif /* !_MSC_VER */
-#else /* Using the DLL. */
-#if !defined _MSC_VER
-#define ACE_Svc_Export _import
-#else
-#define ACE_Svc_Export __declspec (dllimport)
-#endif /* !_MSC_VER */
-#endif /* ACE_BUILD_DLL || ACE_BUILD_SVC_DLL */
-
-#else /* We're not building a DLL! */
-#define ACE_Svc_Export
-#endif /* ACE_HAS_DLL */
-
-// This needs to go here *first* to avoid problems with AIX.
-// Just to be safe we'll do it with pthreads, too -- jwr
-#if defined (ACE_HAS_DCETHREADS) || defined (ACE_HAS_PTHREADS)
-extern "C" {
-#include /**/ <pthread.h>
-#if defined (DIGITAL_UNIX)
-#define pthread_self __pthread_self
-extern "C" pthread_t pthread_self (void);
-#endif /* DIGITAL_UNIX */
-}
-#endif /* ACE_HAS_DCETHREADS */
-
-#if (ACE_NTRACE == 1)
-#define ACE_TRACE(X)
-#else
-#define ACE_TRACE(X) ACE_Trace ____ (X, __LINE__, __FILE__)
-#endif /* ACE_NTRACE */
-
-#include /**/ <time.h>
-#if defined (ACE_NEEDS_SYSTIME_H)
-// Some platforms may need to include this, but I suspect that most
-// will get it from <time.h>
-#if defined (VXWORKS)
-#include /**/ <sys/times.h>
-#else
-#include /**/ <sys/time.h>
-#endif /* VXWORKS */
-#endif /* ACE_NEEDS_SYSTIME_H */
-
-#if !defined (ACE_HAS_POSIX_TIME)
-// Definition per POSIX.
-typedef struct timespec
-{
- time_t tv_sec; // Seconds
- long tv_nsec; // Nanoseconds
-} timespec_t;
-#elif defined (ACE_HAS_BROKEN_POSIX_TIME)
-// OSF/1 defines struct timespec in <sys/timers.h> - Tom Marrs
-#include /**/ <sys/timers.h>
-#endif /* ACE_HAS_POSIX_TIME */
-
-// #if (!defined (timespec) && !defined (m88k))
-// #define timestruc_t struct timespec
-// #endif /* timespec */
-
-#if !defined (ACE_HAS_SVR4_TIME)
-// Definition per SVr4.
-typedef struct timespec timestruc_t;
-#endif /* ACE_HAS_SVR4_TIME */
-
-class ACE_Export ACE_Time_Value
- // = TITLE
- // Operations on "timeval" structures.
- //
- // = DESCRIPTION
- // This class centralizes all the time-related processing in
- // ACE. These timers are typically used in conjunction with
- // lower-level OS mechanisms like select(), poll(), or
- // cond_timedwait(). ACE_Time_Value help make the use of these
- // mechanisms portable across OS platforms,
-{
-public:
- // = Useful constants.
- static const ACE_Time_Value zero;
- // Constant "0".
-
- // = Initialization method.
- ACE_Time_Value (long sec = 0, long usec = 0);
- // Default constructor.
-
- // = Methods for converting to/from various time formats.
- ACE_Time_Value (const struct timeval &t);
- // Construct a Time_Value from a timeval.
-
- ACE_Time_Value (const timestruc_t &t);
- // Initializes the ACE_Time_Value object from a timestruc_t.
-
- ACE_Time_Value (const ACE_Time_Value &tv);
- // Copy constructor.
-
-#if defined(ACE_WIN32)
- ACE_Time_Value (const FILETIME &ft);
- // Initializes the ACE_Time_Value object from a Win32 FILETIME
-#endif
-
- void set (long sec = 0, long usec = 0);
- // Construct a Time_Value from a timeval.
-
- void set (const timeval &t);
- // Construct a Time_Value from a timeval.
-
- void set (const timestruc_t &t);
- // Initializes the ACE_Time_Value object from a timestruc_t.
-
-#if defined(ACE_WIN32)
- void set (const FILETIME &ft);
- // Initializes the ACE_Time_Value object from a timestruc_t.
-#endif
-
- long msec (void) const;
- // Converts from Time_Value format into milli-seconds format.
-
- void msec (long);
- // Converts from milli-seconds format into Time_Value format.
-
- operator timestruc_t () const;
- // Returns the value of the object as a timestruc_t.
-
- operator timeval () const;
- // Returns the value of the object as a timeval.
-
-#if defined(ACE_WIN32)
- operator FILETIME () const;
- // Returns the value of the object as a Win32 FILETIME.
-#endif
-
- // = The following are accessor/mutator methods.
-
- long sec (void) const;
- // Get seconds.
-
- void sec (long sec);
- // Set seconds.
-
- long usec (void) const;
- // Get microseconds.
-
- void usec (long usec);
- // Set microseconds.
-
- // = The following are arithmetic methods for operating on
- // Time_Values.
-
- void operator += (const ACE_Time_Value &tv);
- // Add <tv> to this.
-
- void operator -= (const ACE_Time_Value &tv);
- // Subtract <tv> to this.
-
- friend ACE_Export ACE_Time_Value operator + (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
- // Adds two ACE_Time_Value objects together, returns the sum.
-
- friend ACE_Export ACE_Time_Value operator - (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
- // Subtracts two ACE_Time_Value objects, returns the difference.
-
- friend ACE_Export int operator < (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
- // True if tv1 < tv2.
-
- friend ACE_Export int operator > (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
- // True if tv1 > tv2.
-
- friend ACE_Export int operator <= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
- // True if tv1 <= tv2.
-
- friend ACE_Export int operator >= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
- // True if tv1 >= tv2.
-
- friend ACE_Export int operator == (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
- // True if tv1 == tv2.
-
- friend ACE_Export int operator != (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2);
- // True if tv1 != tv2.
-
- void dump (void) const;
- // Dump the state of an object.
-
-private:
- void normalize (void);
- // Put the timevalue into a canonical form.
-
- long tv_sec_;
- // Seconds.
-
- long tv_usec_;
- // Microseconds.
-};
-
-class ACE_Export ACE_Countdown_Time
- // = TITLE
- // Keeps track of the amount of elapsed time.
- //
- // = DESCRIPTION
- // This class has a side-effect on the <max_wait_time> -- every
- // time the <stop> method is called the <max_wait_time> is
- // updated.
-{
-public:
- // = Initialization and termination methods.
- ACE_Countdown_Time (ACE_Time_Value *max_wait_time);
- // Cache the <max_wait_time> and call <start>.
-
- ~ACE_Countdown_Time (void);
- // Call <stop>.
-
- int start (void);
- // Cache the current time and enter a start state.
-
- int stop (void);
- // Subtract the elapsed time from max_wait_time_ and enter a stopped
- // state.
-
- int update (void);
- // Calls stop and then start. max_wait_time_ is modified by the
- // call to stop.
-
-private:
- ACE_Time_Value *max_wait_time_;
- // Maximum time we were willing to wait.
-
- ACE_Time_Value start_time_;
- // Beginning of the start time.
-
- int stopped_;
- // Keeps track of whether we've already been stopped.
-};
-
-#if defined (__ACE_INLINE__)
-#include "ace/Time_Value.i"
-#endif /* __ACE_INLINE__ */
+#include "ace/OS.h"
#endif /* ACE_TIME_VALUE */
diff --git a/ace/Time_Value.i b/ace/Time_Value.i
deleted file mode 100644
index c2e8ec9bd9b..00000000000
--- a/ace/Time_Value.i
+++ /dev/null
@@ -1,166 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// Time_Value.i
-
-#include "ace/Trace.h"
-
-// Don't put this in the class since it will expand the size! Also,
-// can't make this an enum due to compiler bugs on some platforms...
-static const long ONE_SECOND = 1000000L;
-
-// Initializes the ACE_Time_Value object.
-
-// Initializes a timestruc_t. Note that this approach loses precision
-// since it converts the nano-seconds into micro-seconds. But then
-// again, do any real systems have nano-second timer precision
-// anyway?!
-
-ACE_INLINE void
-ACE_Time_Value::set (const timestruc_t &tv)
-{
- // ACE_TRACE ("ACE_Time_Value::set");
- this->tv_sec_ = tv.tv_sec;
- this->tv_usec_ = tv.tv_nsec / 1000;
-
- this->normalize ();
-}
-
-// Returns the value of the object as a timestruc_t.
-
-ACE_INLINE
-ACE_Time_Value::operator timestruc_t () const
-{
- // ACE_TRACE ("ACE_Time_Value::operator timestruc_t");
- timestruc_t tv;
- tv.tv_sec = this->tv_sec_;
- tv.tv_nsec = this->tv_usec_ * 1000;
- return tv;
-}
-
-// Initializes the ACE_Time_Value object from a timestruc_t.
-
-ACE_INLINE
-ACE_Time_Value::ACE_Time_Value (const timestruc_t &tv)
-{
- // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value");
- this->set (tv);
-}
-
-ACE_INLINE void
-ACE_Time_Value::set (const timeval &tv)
-{
- // ACE_TRACE ("ACE_Time_Value::set");
- this->tv_sec_ = tv.tv_sec;
- this->tv_usec_ = tv.tv_usec;
-
- this->normalize ();
-}
-
-// Initializes the ACE_Time_Value object from another ACE_Time_Value
-
-ACE_INLINE
-ACE_Time_Value::ACE_Time_Value (const ACE_Time_Value &tv)
- : tv_sec_ (tv.tv_sec_),
- tv_usec_ (tv.tv_usec_)
-{
- // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value");
-}
-
-// Returns number of seconds.
-
-ACE_INLINE long
-ACE_Time_Value::sec (void) const
-{
- // ACE_TRACE ("ACE_Time_Value::sec");
- return this->tv_sec_;
-}
-
-// Sets the number of seconds.
-
-ACE_INLINE void
-ACE_Time_Value::sec (long sec)
-{
- // ACE_TRACE ("ACE_Time_Value::sec");
- this->tv_sec_ = sec;
-}
-
-// Converts from Time_Value format into milli-seconds format.
-
-ACE_INLINE long
-ACE_Time_Value::msec (void) const
-{
- // ACE_TRACE ("ACE_Time_Value::msec");
- return this->tv_sec_ * 1000 + this->tv_usec_ / 1000;
-}
-
-// Converts from milli-seconds format into Time_Value format.
-
-ACE_INLINE void
-ACE_Time_Value::msec (long milliseconds)
-{
- // ACE_TRACE ("ACE_Time_Value::msec");
- // Convert millisecond units to seconds;
- this->tv_sec_ = milliseconds / 1000;
- // Convert remainder to microseconds;
- this->tv_usec_ = (milliseconds - (this->tv_sec_ * 1000)) * 1000;
-}
-
-// Returns number of micro-seconds.
-
-ACE_INLINE long
-ACE_Time_Value::usec (void) const
-{
- // ACE_TRACE ("ACE_Time_Value::usec");
- return this->tv_usec_;
-}
-
-// Sets the number of micro-seconds.
-
-ACE_INLINE void
-ACE_Time_Value::usec (long usec)
-{
- // ACE_TRACE ("ACE_Time_Value::usec");
- this->tv_usec_ = usec;
-}
-
-// True if tv1 < tv2.
-
-ACE_INLINE int
-operator < (const ACE_Time_Value &tv1,
- const ACE_Time_Value &tv2)
-{
- // ACE_TRACE ("operator <");
- return tv2 > tv1;
-}
-
-// True if tv1 >= tv2.
-
-ACE_INLINE int
-operator <= (const ACE_Time_Value &tv1,
- const ACE_Time_Value &tv2)
-{
- // ACE_TRACE ("operator <=");
- return tv2 >= tv1;
-}
-
-// True if tv1 == tv2.
-
-ACE_INLINE int
-operator == (const ACE_Time_Value &tv1,
- const ACE_Time_Value &tv2)
-{
- // ACE_TRACE ("operator ==");
- return tv1.tv_sec_ == tv2.tv_sec_
- && tv1.tv_usec_ == tv2.tv_usec_;
-}
-
-// True if tv1 != tv2.
-
-ACE_INLINE int
-operator != (const ACE_Time_Value &tv1,
- const ACE_Time_Value &tv2)
-{
- // ACE_TRACE ("operator !=");
- return !(tv1 == tv2);
-}
diff --git a/ace/Timer_Heap.h b/ace/Timer_Heap.h
index de0b37295fb..963c4d28967 100644
--- a/ace/Timer_Heap.h
+++ b/ace/Timer_Heap.h
@@ -47,7 +47,7 @@ protected:
};
class ACE_Export ACE_Timer_Heap : public ACE_Timer_Queue
- // = TITLE
+ // = TITLE
// Provides a very fast and predictable timer implementation.
//
// = DESCRIPTION
diff --git a/ace/Timer_List.h b/ace/Timer_List.h
index 500faa8ff7d..fa25fdbafa0 100644
--- a/ace/Timer_List.h
+++ b/ace/Timer_List.h
@@ -47,7 +47,7 @@ protected:
};
class ACE_Export ACE_Timer_List : public ACE_Timer_Queue
- // = TITLE
+ // = TITLE
// Provides a simple implementation of timers.
//
// = DESCRIPTION
diff --git a/ace/Timer_Queue.h b/ace/Timer_Queue.h
index 2a49c108e61..14c2440ae00 100644
--- a/ace/Timer_Queue.h
+++ b/ace/Timer_Queue.h
@@ -95,7 +95,7 @@ public:
};
class ACE_Export ACE_Timer_Queue
- // = TITLE
+ // = TITLE
// Provides an interface to timers.
//
// = DESCRIPTION
diff --git a/ace/Token.cpp b/ace/Token.cpp
index 4a6fdeda0d3..4b8320cf2e2 100644
--- a/ace/Token.cpp
+++ b/ace/Token.cpp
@@ -3,7 +3,6 @@
#define ACE_BUILD_DLL
#include "ace/Thread.h"
-#include "ace/Time_Value.h"
#include "ace/Token.h"
#if defined (ACE_HAS_THREADS)
diff --git a/ace/config-mvs.h b/ace/config-mvs.h
index b82387d593d..ac46a9ef617 100644
--- a/ace/config-mvs.h
+++ b/ace/config-mvs.h
@@ -7,6 +7,12 @@
// Platform supports getpagesize() call.
#define ACE_HAS_GETPAGESIZE
+// highest possible errno.
+#define ERRMAX 100
+
+// Platform does not define sys_nerr
+#define ACE_LACKS_SYS_NERR
+
// The following #defines are hacks to get around things
// that seem to be missing or different in MVS land
#define MAXPATHLEN 1024 /* sys/param.h not on MVS */
diff --git a/ace/config-sunos5.5-g++.h b/ace/config-sunos5.5-g++.h
index a3b0ce9a842..fbef6680232 100644
--- a/ace/config-sunos5.5-g++.h
+++ b/ace/config-sunos5.5-g++.h
@@ -7,6 +7,7 @@
#if !defined (ACE_CONFIG_H)
#define ACE_CONFIG_H
+#define ACE_HAS_EXCEPTIONS
#define ACE_HAS_UNICODE
// G++ doesn't support template typedefs fully (yet).
diff --git a/ace/config-sunos5.5-sunc++-4.1.h b/ace/config-sunos5.5-sunc++-4.1.h
index cddd6e98604..5152c480c1a 100644
--- a/ace/config-sunos5.5-sunc++-4.1.h
+++ b/ace/config-sunos5.5-sunc++-4.1.h
@@ -7,6 +7,7 @@
#if !defined (ACE_CONFIG_H)
#define ACE_CONFIG_H
+#define ACE_HAS_EXCEPTIONS
#define ACE_HAS_UNICODE
// Note that SunC++ 4.1 fixes template bugs that prevented earlier
diff --git a/ace/config-sunos5.5-sunc++-4.x-orbix.h b/ace/config-sunos5.5-sunc++-4.x-orbix.h
index d778a0f57cc..e470b37e0d8 100644
--- a/ace/config-sunos5.5-sunc++-4.x-orbix.h
+++ b/ace/config-sunos5.5-sunc++-4.x-orbix.h
@@ -9,6 +9,8 @@
#if !defined (ACE_CONFIG_H)
#define ACE_CONFIG_H
+#define ACE_HAS_EXCEPTIONS
+
// Platform contains the Orbix CORBA implementation.
#define ACE_HAS_ORBIX
diff --git a/ace/config-sunos5.5-sunc++-4.x.h b/ace/config-sunos5.5-sunc++-4.x.h
index e374a75e1bd..6d48e9d2150 100644
--- a/ace/config-sunos5.5-sunc++-4.x.h
+++ b/ace/config-sunos5.5-sunc++-4.x.h
@@ -7,6 +7,8 @@
#if !defined (ACE_CONFIG_H)
#define ACE_CONFIG_H
+#define ACE_HAS_EXCEPTIONS
+
#define ACE_HAS_UNICODE
// #define ACE_HAS_TEMPLATE_TYPEDEFS
diff --git a/ace/config-vxworks5.2-g++.h b/ace/config-vxworks5.2-g++.h
index cc9bfd30a34..e12e7a23618 100644
--- a/ace/config-vxworks5.2-g++.h
+++ b/ace/config-vxworks5.2-g++.h
@@ -7,6 +7,7 @@
#if !defined (ACE_CONFIG_H)
#define ACE_CONFIG_H
+#define ACE_LACKS_SYS_NERR
#define ACE_LACKS_COND_T
#define ACE_LACKS_RWLOCK_T
#define ACE_HAS_BROKEN_SENDMSG
diff --git a/ace/config-win32-msvc2.0.h b/ace/config-win32-msvc2.0.h
index 8035840ec6f..ffb5c40c167 100644
--- a/ace/config-win32-msvc2.0.h
+++ b/ace/config-win32-msvc2.0.h
@@ -8,6 +8,8 @@
#if !defined (ACE_CONFIG_H)
#define ACE_CONFIG_H
+#define ACE_HAS_EXCEPTIONS
+
// We are using STL's min and max (in algobase.h). Therefore the
// macros in window.h are extra
#if !defined NOMINMAX
diff --git a/ace/config-win32-msvc4.x.h b/ace/config-win32-msvc4.x.h
index 51f94845a6f..dd5441e15d1 100644
--- a/ace/config-win32-msvc4.x.h
+++ b/ace/config-win32-msvc4.x.h
@@ -8,6 +8,8 @@
#if !defined (ACE_CONFIG_H)
#define ACE_CONFIG_H
+#define ACE_HAS_EXCEPTIONS
+
// We are using STL's min and max (in algobase.h). Therefore the
// macros in window.h are extra
#if !defined NOMINMAX
diff --git a/ace/config-winnt-4.0-msvc4.x.h b/ace/config-winnt-4.0-msvc4.x.h
index 65b9014d896..4d8b69ab5a3 100644
--- a/ace/config-winnt-4.0-msvc4.x.h
+++ b/ace/config-winnt-4.0-msvc4.x.h
@@ -7,6 +7,8 @@
#if !defined (ACE_CONFIG_H)
#define ACE_CONFIG_H
+#define ACE_HAS_EXCEPTIONS
+
// We are using STL's min and max (in algobase.h). Therefore the
// macros in window.h are extra
#if !defined NOMINMAX