summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-07-26 18:54:39 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-07-26 18:54:39 +0000
commit15bc210e1a411ac93b0d2a41e0b898ba16583e05 (patch)
treee08bf39d3f5e4db1b282454d79a053355330fa0d /ace
parentb5adfd4ffd24551632be96077fe9f519e10bfff7 (diff)
downloadATCD-15bc210e1a411ac93b0d2a41e0b898ba16583e05.tar.gz
*** empty log message ***
Diffstat (limited to 'ace')
-rw-r--r--ace/Proactor.cpp195
-rw-r--r--ace/Proactor.h75
-rw-r--r--ace/Process_Manager.cpp1
-rw-r--r--ace/Reactor.cpp149
-rw-r--r--ace/Reactor.h43
-rw-r--r--ace/ReactorEx.cpp168
-rw-r--r--ace/ReactorEx.h63
-rw-r--r--ace/Read_Buffer.cpp4
-rw-r--r--ace/Remote_Tokens.cpp2
-rw-r--r--ace/Remote_Tokens.h1
-rw-r--r--ace/SString.cpp30
-rw-r--r--ace/Service_Config.cpp448
-rw-r--r--ace/Service_Config.h106
-rw-r--r--ace/Service_Main.cpp7
-rw-r--r--ace/Service_Manager.cpp23
-rw-r--r--ace/Service_Repository.cpp60
-rw-r--r--ace/Service_Repository.h19
-rw-r--r--ace/Signal.cpp3
-rw-r--r--ace/Signal.h2
-rw-r--r--ace/Strategies_T.cpp4
-rw-r--r--ace/Svc_Handler.cpp4
-rw-r--r--ace/Svc_Handler.h4
-rw-r--r--ace/Synch.cpp1
-rw-r--r--ace/System_Time.h6
-rw-r--r--ace/Task.cpp6
-rw-r--r--ace/Task.h4
-rw-r--r--ace/Task_T.cpp2
-rw-r--r--ace/Thread_Manager.cpp63
-rw-r--r--ace/Thread_Manager.h16
-rw-r--r--ace/Token.cpp1
-rw-r--r--ace/Token.h1
-rw-r--r--ace/UPIPE_Stream.h2
-rw-r--r--ace/XtReactor.cpp2
-rw-r--r--ace/ace.mak66
-rw-r--r--ace/ace.mdpbin111616 -> 111616 bytes
-rw-r--r--ace/config-aix-4.1.x.h4
-rw-r--r--ace/config-aix-4.2.x.h4
-rw-r--r--ace/config-chorus.h4
-rw-r--r--ace/config-dgux-4.11-epc.h4
-rw-r--r--ace/config-freebsd-pthread.h4
-rw-r--r--ace/config-hpux-10.x-aCC.h3
-rw-r--r--ace/config-hpux-10.x-decthreads.h4
-rw-r--r--ace/config-hpux-10.x-nothread.h4
-rw-r--r--ace/config-hpux-10.x.h4
-rw-r--r--ace/config-hpux-9.x-orbix.h2
-rw-r--r--ace/config-irix6.2-sgic++.h4
-rw-r--r--ace/config-irix6.4-sgic++.h4
-rw-r--r--ace/config-linux-lxpthreads.h4
-rw-r--r--ace/config-linux-pthread.h4
-rw-r--r--ace/config-m88k.h4
-rw-r--r--ace/config-mvs.h4
-rw-r--r--ace/config-osf1-3.2.h4
-rw-r--r--ace/config-osf1-4.0-g++.h4
-rw-r--r--ace/config-osf1-4.0.h4
-rw-r--r--ace/config-sco-5.0.0-mit-pthread.h4
-rw-r--r--ace/config-sunos4-sun4.x-orbix.h2
-rw-r--r--ace/config-sunos5.4-centerline-2.x.h4
-rw-r--r--ace/config-sunos5.4-g++.h6
-rw-r--r--ace/config-sunos5.4-sunc++-4.x-orbix.h6
-rw-r--r--ace/config-sunos5.4-sunc++-4.x.h4
-rw-r--r--ace/config-sunos5.5-g++.h6
-rw-r--r--ace/config-sunos5.5-sunc++-4.x-orbix.h2
-rw-r--r--ace/config-sunos5.5-sunc++-4.x.h4
-rw-r--r--ace/config-sunx86-sunc++-4.x.h4
-rw-r--r--ace/config-tandem.h7
-rw-r--r--ace/config-unixware-2.01-g++.h4
-rw-r--r--ace/config-unixware-2.1.2-g++.h4
-rw-r--r--ace/config-vxworks-ghs-1.8.h4
-rw-r--r--ace/config-vxworks5.x-g++.h4
-rw-r--r--ace/config-win32-common.h34
-rw-r--r--ace/config-win32.h41
71 files changed, 1135 insertions, 659 deletions
diff --git a/ace/Proactor.cpp b/ace/Proactor.cpp
index 9fd263b1f3c..04426c67864 100644
--- a/ace/Proactor.cpp
+++ b/ace/Proactor.cpp
@@ -7,13 +7,29 @@
#if defined (ACE_WIN32)
// This only works on Win32 platforms
-#include "ace/Task.h"
+#include "ace/Task_T.h"
#include "ace/Log_Msg.h"
+#include "ace/Service_Config.h"
#if !defined (__ACE_INLINE__)
#include "ace/Proactor.i"
#endif /* __ACE_INLINE__ */
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+// Lock the creation of the Singleton.
+static ACE_Thread_Mutex ace_proactor_lock_;
+#endif /* ACE_MT_SAFE */
+
+// Process-wide ACE_Proactor.
+ACE_Proactor *ACE_Proactor::proactor_ = 0;
+
+// Controls whether the Proactor is deleted when we shut down (we can
+// only delete it safely if we created it!)
+int ACE_Proactor::delete_proactor_ = 0;
+
+// Terminate the eventloop.
+sig_atomic_t ACE_Proactor::end_event_loop_ = 0;
+
class ACE_Export ACE_Proactor_Timer_Handler : public ACE_Task <ACE_NULL_SYNCH>
//
// = TITLE
@@ -220,6 +236,113 @@ ACE_Proactor::ACE_Proactor (size_t number_of_threads,
}
+ACE_Proactor *
+ACE_Proactor::instance (size_t threads)
+{
+ ACE_TRACE ("ACE_Proactor::instance");
+
+ if (ACE_Proactor::proactor_ == 0)
+ {
+ // Perform Double-Checked Locking Optimization.
+ ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_proactor_lock_, 0));
+
+ if (ACE_Proactor::proactor_ == 0)
+ {
+ ACE_NEW_RETURN (ACE_Proactor::proactor_, ACE_Proactor (threads), 0);
+ ACE_Proactor::delete_proactor_ = 1;
+ }
+ }
+ return ACE_Proactor::proactor_;
+}
+
+ACE_Proactor *
+ACE_Proactor::instance (ACE_Proactor *r)
+{
+ ACE_TRACE ("ACE_Proactor::instance");
+
+ ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_proactor_lock_, 0));
+
+ ACE_Proactor *t = ACE_Proactor::proactor_;
+ // We can't safely delete it since we don't know who created it!
+ ACE_Proactor::delete_proactor_ = 0;
+
+ ACE_Proactor::proactor_ = r;
+ return t;
+}
+
+void
+ACE_Proactor::close_singleton (void)
+{
+ ACE_TRACE ("ACE_Proactor::close_singleton");
+
+ ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, ace_proactor_lock_));
+
+ if (ACE_Proactor::delete_proactor_)
+ {
+ delete ACE_Proactor::proactor_;
+ ACE_Proactor::proactor_ = 0;
+ ACE_Proactor::delete_proactor_ = 0;
+ }
+}
+
+int
+ACE_Proactor::run_event_loop (void)
+{
+ ACE_TRACE ("ACE_Proactor::run_event_loop");
+
+ while (ACE_Proactor::end_event_loop_ == 0)
+ {
+ int result = ACE_Proactor::instance ()->handle_events ();
+
+ if (ACE_Service_Config::reconfig_occurred ())
+ ACE_Service_Config::reconfigure ();
+
+ else if (result == -1)
+ return -1;
+ }
+ /* NOTREACHED */
+ return 0;
+}
+
+// Handle events for -tv- time. handle_events updates -tv- to reflect
+// time elapsed, so do not return until -tv- == 0, or an error occurs.
+int
+ACE_Proactor::run_event_loop (ACE_Time_Value &tv)
+{
+ ACE_TRACE ("ACE_Proactor::run_event_loop");
+
+ while (ACE_Proactor::end_event_loop_ == 0 && tv != ACE_Time_Value::zero)
+ {
+ int result = ACE_Proactor::instance ()->handle_events (tv);
+ if (ACE_Service_Config::reconfig_occurred ())
+ ACE_Service_Config::reconfigure ();
+
+ // An error has occurred.
+ else if (result == -1)
+ return result;
+ }
+
+ /* NOTREACHED */
+ return 0;
+}
+
+int
+ACE_Proactor::end_event_loop (void)
+{
+ ACE_TRACE ("ACE_Proactor::end_event_loop");
+ ACE_Proactor::end_event_loop_ = 1;
+ // ACE_Proactor::instance()->notify ();
+ return 0;
+}
+
+/* static */
+sig_atomic_t
+ACE_Proactor::event_loop_done (void)
+{
+ ACE_TRACE ("ACE_Proactor::event_loop_done");
+ return ACE_Proactor::end_event_loop_;
+}
+
ACE_Proactor::~ACE_Proactor (void)
{
this->close ();
@@ -454,30 +577,6 @@ ACE_Proactor::application_specific_code (ACE_Asynch_Result *asynch_result,
}
int
-ACE_Proactor::run_proactor_event_loop (void)
-{
- return 0;
-}
-
-int
-ACE_Proactor::run_event_loop (ACE_Time_Value &)
-{
- return 0;
-}
-
-int
-ACE_Proactor::end_event_loop (void)
-{
- return 0;
-}
-
-sig_atomic_t
-ACE_Proactor::event_loop_done (void)
-{
- return 0;
-}
-
-int
ACE_Proactor::wake_up_dispatch_threads (void)
{
return 0;
@@ -551,4 +650,50 @@ ACE_Proactor::Asynch_Timer::complete (u_long bytes_transferred,
this->handler_.handle_time_out (this->time_, this->act ());
}
+#else /* ACE_WIN32 */
+
+ACE_Proactor *
+ACE_Proactor::instance (void)
+{
+ return NULL;
+}
+
+ACE_Proactor *
+ACE_Proactor::instance (ACE_Proactor *)
+{
+ return NULL;
+}
+
+void
+ACE_Proactor::close_singleton (void)
+{
+}
+
+int
+ACE_Proactor::run_event_loop (void)
+{
+ // not implemented
+ return -1;
+}
+
+int
+ACE_Proactor::run_event_loop (ACE_Time_Value &tv)
+{
+ // not implemented
+ return -1;
+}
+
+int
+ACE_Proactor::end_event_loop (void)
+{
+ // not implemented
+ return -1;
+}
+
+sig_atomic_t
+ACE_Proactor::event_loop_done (void)
+{
+ return sig_atomic_t (1);
+}
#endif /* ACE_WIN32 */
+
diff --git a/ace/Proactor.h b/ace/Proactor.h
index bab67676b14..5bbabbd1313 100644
--- a/ace/Proactor.h
+++ b/ace/Proactor.h
@@ -139,6 +139,35 @@ public:
virtual ~ACE_Proactor (void);
// Virtual destruction.
+ static ACE_Proactor *instance (size_t threads = 0);
+ // Get pointer to a process-wide <ACE_Proactor>. <threads> should
+ // be part of another method. It's only here because I'm just a
+ // grad student and not in charge. No, I'm not bitter about this.
+
+ static ACE_Proactor *instance (ACE_Proactor *);
+ // Set pointer to a process-wide <ACE_Proactor> and return existing
+ // pointer.
+
+ static void close_singleton (void);
+ // Delete the dynamically allocated Singleton
+
+ // = Proactor event loop management methods.
+ static int run_event_loop (void);
+ // Run the event loop until the <ACE_Proactor::handle_events>
+ // method returns -1 or the <end_event_loop> method
+ // is invoked.
+
+ static int run_event_loop (ACE_Time_Value &tv);
+ // Run the event loop until the <ACE_Proactor::handle_events>
+ // method returns -1, the <end_event_loop> method
+ // is invoked, or the <ACE_Time_Value> expires.
+
+ static int end_event_loop (void);
+ // Instruct the <ACE_Proactor::instance> to terminate its event loop.
+
+ static sig_atomic_t event_loop_done (void);
+ // Report if the <ACE_Proactor::instance> event loop is finished.
+
virtual int close (void);
// Close the IO completion port
@@ -195,21 +224,6 @@ public:
virtual int handle_events (void);
// Block indefinitely until at least one event is dispatched.
- // = Event loop management methods.
- int run_proactor_event_loop (void);
- // Run the event loop until the this->handle_events returns -1 or
- // the this->end_event_loop is invoked.
-
- int run_event_loop (ACE_Time_Value &tv);
- // Run the event loop until the this->handle_events returns -1, the
- // this->end_event_loop is invoked, or <tv> expires.
-
- int end_event_loop (void);
- // Terminates a this->run_event_loop call.
-
- sig_atomic_t event_loop_done (void);
- // Report if the Proactor's event loop is finished.
-
int wake_up_dispatch_threads (void);
// Add wakeup dispatch threads (reinit).
@@ -304,6 +318,16 @@ protected:
int used_with_reactorEx_event_loop_;
// Flag that indicates whether we are used in conjunction with
// ReactorEx
+
+private:
+ static ACE_Proactor *proactor_;
+ // Pointer to a process-wide <ACE_Proactor>.
+
+ static int delete_proactor_;
+ // Must delete the <proactor_> if non-0.
+
+ static sig_atomic_t end_event_loop_;
+ // Terminate the proactor event loop.
};
#if defined (__ACE_INLINE__)
@@ -320,6 +344,27 @@ public:
Timer_Queue * /* tq */ = 0) {}
virtual int handle_events (void) { return -1; }
virtual int handle_events (ACE_Time_Value &) { return -1; }
+
+ static ACE_Proactor *instance (size_t threads = 0);
+ // Placeholder to enable compilation on non-Win32 platforms
+
+ static ACE_Proactor *instance (ACE_Proactor *);
+ // Placeholder to enable compilation on non-Win32 platforms
+
+ static void close_singleton (void);
+ // Placeholder to enable compilation on non-Win32 platforms
+
+ static int run_event_loop (void);
+ // Placeholder to enable compilation on non-Win32 platforms
+
+ static int run_event_loop (ACE_Time_Value &tv);
+ // Placeholder to enable compilation on non-Win32 platforms
+
+ static int end_event_loop (void);
+ // Placeholder to enable compilation on non-Win32 platforms
+
+ static sig_atomic_t event_loop_done (void);
+ // Placeholder to enable compilation on non-Win32 platforms
};
#endif /* ACE_WIN32 */
diff --git a/ace/Process_Manager.cpp b/ace/Process_Manager.cpp
index 33bcee42c95..f23432b1520 100644
--- a/ace/Process_Manager.cpp
+++ b/ace/Process_Manager.cpp
@@ -2,6 +2,7 @@
// Process_Manager.cpp
#define ACE_BUILD_DLL
+#include "ace/Synch_T.h"
#include "ace/Process.h"
#include "ace/Process_Manager.h"
diff --git a/ace/Reactor.cpp b/ace/Reactor.cpp
index b4b18cea88d..d15b66b2d11 100644
--- a/ace/Reactor.cpp
+++ b/ace/Reactor.cpp
@@ -7,6 +7,7 @@
#include "ace/SOCK_Connector.h"
#include "ace/Timer_List.h"
#include "ace/Reactor.h"
+#include "ace/Service_Config.h"
#if !defined (__ACE_INLINE__)
#include "ace/Reactor.i"
@@ -22,6 +23,21 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Reactor)
#define ACE_REACTOR_EVENT_HANDLER(THIS,H) ((THIS)->event_handlers_[(H)])
#endif /* ACE_WIN32 */
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+// Lock the creation of the Singleton.
+static ACE_Thread_Mutex ace_reactor_lock_;
+#endif /* ACE_MT_SAFE */
+
+// Process-wide ACE_Reactor.
+ACE_Reactor *ACE_Reactor::reactor_ = 0;
+
+// Controls whether the Reactor is deleted when we shut down (we can
+// only delete it safely if we created it!)
+int ACE_Reactor::delete_reactor_ = 0;
+
+// Terminate the eventloop.
+sig_atomic_t ACE_Reactor::end_event_loop_ = 0;
+
// Performs sanity checking on the ACE_HANDLE.
int
@@ -540,7 +556,7 @@ ACE_Reactor::max_notify_iterations (void)
return this->max_notify_iterations_;
}
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
// Enqueue ourselves into the list of waiting threads.
void
ACE_Reactor::renew (void)
@@ -747,7 +763,7 @@ ACE_Reactor::notify (ACE_Event_Handler *eh,
ssize_t n = 0;
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
// Pass over both the Event_Handler *and* the mask to allow the
// caller to dictate which Event_Handler method the receiver
// invokes. Note that this call can timeout.
@@ -890,6 +906,121 @@ ACE_Reactor::ready_ops (ACE_HANDLE handle,
ops);
}
+ACE_Reactor *
+ACE_Reactor::instance (size_t size /* = ACE_Reactor::DEFAULT_SIZE */)
+{
+ ACE_TRACE ("ACE_Reactor::instance");
+
+ if (ACE_Reactor::reactor_ == 0)
+ {
+ // Perform Double-Checked Locking Optimization.
+ ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_reactor_lock_, 0));
+
+ if (ACE_Reactor::reactor_ == 0)
+ {
+ ACE_NEW_RETURN (ACE_Reactor::reactor_, ACE_Reactor (size), NULL);
+ ACE_Reactor::delete_reactor_ = 1;
+ }
+ }
+ return ACE_Reactor::reactor_;
+}
+
+ACE_Reactor *
+ACE_Reactor::instance (ACE_Reactor *r)
+{
+ ACE_TRACE ("ACE_Reactor::instance");
+
+ ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_reactor_lock_, 0));
+ ACE_Reactor *t = ACE_Reactor::reactor_;
+ // We can't safely delete it since we don't know who created it!
+ ACE_Reactor::delete_reactor_ = 0;
+
+ ACE_Reactor::reactor_ = r;
+ return t;
+}
+
+void
+ACE_Reactor::close_singleton (void)
+{
+ ACE_TRACE ("ACE_Reactor::close_singleton");
+
+ ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, ace_reactor_lock_));
+
+ if (ACE_Reactor::delete_reactor_)
+ {
+ delete ACE_Reactor::reactor_;
+ ACE_Reactor::reactor_ = 0;
+ ACE_Reactor::delete_reactor_ = 0;
+ }
+}
+
+// Run the event loop until the <ACE_Reactor::handle_events>
+// method returns -1 or the <end_event_loop> method
+// is invoked.
+
+int
+ACE_Reactor::run_event_loop (void)
+{
+ ACE_TRACE ("ACE_Reactor::run_event_loop");
+
+ while (ACE_Reactor::end_event_loop_ == 0)
+ {
+ int result = ACE_Reactor::instance ()->handle_events ();
+
+ if (ACE_Service_Config::reconfig_occurred ())
+ ACE_Service_Config::reconfigure ();
+
+ else if (result == -1)
+ return -1;
+ }
+ /* NOTREACHED */
+ return 0;
+}
+
+// Run the event loop until the <ACE_Reactor::handle_events>
+// method returns -1, the <end_event_loop> method
+// is invoked, or the <ACE_Time_Value> expires.
+
+int
+ACE_Reactor::run_event_loop (ACE_Time_Value &tv)
+{
+ ACE_TRACE ("ACE_Reactor::run_event_loop");
+
+ while (ACE_Reactor::end_event_loop_ == 0)
+ {
+ int result = ACE_Reactor::instance ()->handle_events (tv);
+
+ if (ACE_Service_Config::reconfig_occurred ())
+ ACE_Service_Config::reconfigure ();
+ else if (result <= 0)
+ return result;
+ }
+
+ /* NOTREACHED */
+ return 0;
+}
+
+/* static */
+int
+ACE_Reactor::end_event_loop (void)
+{
+ ACE_TRACE ("ACE_Reactor::end_event_loop");
+ ACE_Reactor::end_event_loop_ = 1;
+
+ // Send a notification, but don't block if there's no one to receive
+ // it.
+ return ACE_Reactor::instance ()->notify
+ (0, ACE_Event_Handler::NULL_MASK, (ACE_Time_Value *) &ACE_Time_Value::zero);
+}
+
+/* static */
+sig_atomic_t
+ACE_Reactor::event_loop_done (void)
+{
+ ACE_TRACE ("ACE_Reactor::event_loop_done");
+ return ACE_Reactor::end_event_loop_;
+}
+
// Initialize the ACE_Reactor
int
@@ -935,7 +1066,7 @@ ACE_Reactor::open (size_t size,
if (result != -1 && this->handler_rep_.open (size) == -1)
result = -1;
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
else if (this->notify_handler_.open (this) == -1)
result = -1;
#endif /* ACE_MT_SAFE */
@@ -960,7 +1091,7 @@ ACE_Reactor::ACE_Reactor (ACE_Sig_Handler *sh,
max_notify_iterations_ (-1),
initialized_ (0),
state_changed_ (0)
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
, token_ (*this)
#endif /* ACE_MT_SAFE */
{
@@ -984,7 +1115,7 @@ ACE_Reactor::ACE_Reactor (size_t size,
max_notify_iterations_ (-1),
initialized_ (0),
state_changed_ (0)
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
, token_ (*this)
#endif /* ACE_MT_SAFE */
{
@@ -1014,7 +1145,7 @@ ACE_Reactor::close (void)
delete this->timer_queue_;
this->timer_queue_ = 0;
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
this->notify_handler_.close ();
#endif /* ACE_MT_SAFE */
this->initialized_ = 0;
@@ -1412,7 +1543,7 @@ int
ACE_Reactor::dispatch_notification_handlers (int &number_of_active_handles,
ACE_Reactor_Handle_Set &dispatch_set)
{
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
// Check to see if the ACE_HANDLE associated with the Reactor's
// notify hook is enabled. If so, it means that one or more
// other threads are trying to update the ACE_Reactor's internal
@@ -1616,7 +1747,7 @@ ACE_Reactor::handle_events (ACE_Time_Value *max_wait_time)
// called.
ACE_Countdown_Time countdown (max_wait_time);
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
ACE_GUARD_RETURN (ACE_REACTOR_MUTEX, ace_mon, this->token_, -1);
if (ACE_OS::thr_equal (ACE_Thread::self (), this->owner_) == 0)
@@ -1741,7 +1872,7 @@ ACE_Reactor::dump (void) const
ACE_DEBUG ((LM_DEBUG, "\ninitialized_ = %d\n", this->initialized_));
ACE_DEBUG ((LM_DEBUG, "\nowner_ = %d\n", this->owner_));
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
this->notify_handler_.dump ();
this->token_.dump ();
#endif /* ACE_MT_SAFE */
diff --git a/ace/Reactor.h b/ace/Reactor.h
index a3bf36d9d28..a6e0614047c 100644
--- a/ace/Reactor.h
+++ b/ace/Reactor.h
@@ -48,7 +48,7 @@ public:
// Exception events (e.g., SIG_URG).
};
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
// The following two classes have to be moved out here to keep the SGI
// C++ compiler happy (it doesn't like nested classes).
@@ -319,6 +319,34 @@ public:
ACE_Timer_Queue * = 0);
// Initialize <ACE_Reactor> with size <size>.
+ static ACE_Reactor *instance (size_t size = ACE_Reactor::DEFAULT_SIZE);
+ // Get pointer to a process-wide <ACE_Reactor>.
+
+ static ACE_Reactor *instance (ACE_Reactor *);
+ // Set pointer to a process-wide <ACE_Reactor> and return existing
+ // pointer.
+
+ static void close_singleton (void);
+ // Delete the dynamically allocated Singleton
+
+ // = Reactor event loop management methods.
+ static int run_event_loop (void);
+ // Run the event loop until the <ACE_Reactor::handle_events> method
+ // returns -1 or the <end_event_loop> method is invoked.
+
+ static int run_event_loop (ACE_Time_Value &tv);
+ // Run the event loop until the <ACE_Reactor::handle_events> method
+ // returns -1, the <end_event_loop> method is invoked, or the
+ // <ACE_Time_Value> expires.
+
+ static int end_event_loop (void);
+ // Instruct the <ACE_Reactor::instance> to terminate its event loop and
+ // notifies the <ACE_Reactor::instance> so that it can wake up
+ // and close down gracefully.
+
+ static sig_atomic_t event_loop_done (void);
+ // Report if the <ACE_Reactor::instance>'s event loop is finished.
+
virtual int open (size_t size = DEFAULT_SIZE,
int restart = 0,
ACE_Sig_Handler * = 0,
@@ -750,7 +778,7 @@ protected:
ACE_Reactor_Token token_;
// Synchronization token for the MT_SAFE ACE_Reactor.
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
ACE_Reactor_Notify notify_handler_;
// Callback object that unblocks the ACE_Reactor if it's sleeping.
@@ -770,9 +798,18 @@ private:
int handle_events_i (ACE_Time_Value *max_wait_time = 0);
// Stops the VC++ compiler from bitching about exceptions and destructors
- // Deny access since member-wise won't work...
+ static ACE_Reactor *reactor_;
+ // Pointer to a process-wide <ACE_Reactor>.
+
+ static int delete_reactor_;
+ // Must delete the <reactor_> if non-0.
+
+ static sig_atomic_t end_event_loop_;
+ // Terminate the event loop.
+
ACE_Reactor (const ACE_Reactor &);
ACE_Reactor &operator = (const ACE_Reactor &);
+ // Deny access since member-wise won't work...
};
#if defined (__ACE_INLINE__)
diff --git a/ace/ReactorEx.cpp b/ace/ReactorEx.cpp
index 0211d43b02b..2084b1b30d0 100644
--- a/ace/ReactorEx.cpp
+++ b/ace/ReactorEx.cpp
@@ -5,15 +5,32 @@
#include "ace/ReactorEx.h"
#include "ace/Timer_List.h"
#include "ace/Thread.h"
+#include "ace/Service_Config.h"
#if defined (ACE_WIN32)
#if !defined (__ACE_INLINE__)
+#include "ace/Handle_Set.h"
#include "ace/ReactorEx.i"
#endif /* __ACE_INLINE__ */
#include "ace/Auto_Ptr.h"
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+// Lock the creation of the Singleton.
+static ACE_Thread_Mutex ace_reactorex_lock_;
+#endif /* ACE_MT_SAFE */
+
+// Process-wide ACE_ReactorEx.
+ACE_ReactorEx *ACE_ReactorEx::reactorEx_ = 0;
+
+// Controls whether the ReactorEx is deleted when we shut down (we can
+// only delete it safely if we created it!)
+int ACE_ReactorEx::delete_reactorEx_ = 0;
+
+// Terminate the eventloop.
+sig_atomic_t ACE_ReactorEx::end_event_loop_ = 0;
+
/************************************************************/
ACE_ReactorEx_Handler_Repository::ACE_ReactorEx_Handler_Repository (ACE_ReactorEx &reactorEx)
@@ -580,6 +597,109 @@ ACE_ReactorEx::ACE_ReactorEx (size_t size,
ACE_ERROR ((LM_ERROR, "%p\n", "ReactorEx"));
}
+ACE_ReactorEx *
+ACE_ReactorEx::instance (void)
+{
+ ACE_TRACE ("ACE_ReactorEx::instance");
+
+ if (ACE_ReactorEx::reactorEx_ == 0)
+ {
+ // Perform Double-Checked Locking Optimization.
+ ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_reactorex_lock_, 0));
+
+ if (ACE_ReactorEx::reactorEx_ == 0)
+ {
+ ACE_NEW_RETURN (ACE_ReactorEx::reactorEx_, ACE_ReactorEx, 0);
+ ACE_ReactorEx::delete_reactorEx_ = 1;
+ }
+ }
+
+ return ACE_ReactorEx::reactorEx_;
+}
+
+ACE_ReactorEx *
+ACE_ReactorEx::instance (ACE_ReactorEx *r)
+{
+ ACE_TRACE ("ACE_ReactorEx::instance");
+
+ ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_reactorex_lock_, 0));
+ ACE_ReactorEx *t = ACE_ReactorEx::reactorEx_;
+ // We can't safely delete it since we don't know who created it!
+ ACE_ReactorEx::delete_reactorEx_ = 0;
+
+ ACE_ReactorEx::reactorEx_ = r;
+ return t;
+}
+
+void
+ACE_ReactorEx::close_singleton (void)
+{
+ ACE_TRACE ("ACE_ReactorEx::close_singleton");
+
+ ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, ace_reactorex_lock_));
+
+ if (ACE_ReactorEx::delete_reactorEx_)
+ {
+ delete ACE_ReactorEx::reactorEx_;
+ ACE_ReactorEx::reactorEx_ = 0;
+ ACE_ReactorEx::delete_reactorEx_ = 0;
+ }
+}
+
+int
+ACE_ReactorEx::run_event_loop (void)
+{
+ ACE_TRACE ("ACE_ReactorEx::run_event_loop");
+
+ while (ACE_ReactorEx::end_event_loop_ == 0)
+ {
+ int result = ACE_ReactorEx::instance ()->handle_events ();
+
+ if (ACE_Service_Config::reconfig_occurred ())
+ ACE_Service_Config::reconfigure ();
+
+ else if (result == -1)
+ return -1;
+ }
+ /* NOTREACHED */
+ return 0;
+}
+
+
+int
+ACE_ReactorEx::run_event_loop (ACE_Time_Value &tv)
+{
+ ACE_TRACE ("ACE_ReactorEx::run_event_loop");
+
+ while (ACE_ReactorEx::end_event_loop_ == 0 && tv != ACE_Time_Value::zero)
+ {
+ int result = ACE_ReactorEx::instance ()->handle_events (tv);
+ if (ACE_Service_Config::reconfig_occurred ())
+ ACE_Service_Config::reconfigure ();
+ else if (result == -1)
+ return result;
+ }
+
+ /* NOTREACHED */
+ return 0;
+}
+
+int
+ACE_ReactorEx::end_event_loop (void)
+{
+ ACE_TRACE ("ACE_ReactorEx::end_event_loop");
+ ACE_ReactorEx::end_event_loop_ = 1;
+ return ACE_ReactorEx::instance ()->notify ();
+}
+
+/* static */
+sig_atomic_t
+ACE_ReactorEx::event_loop_done (void)
+{
+ ACE_TRACE ("ACE_ReactorEx::end_event_loop");
+ return ACE_ReactorEx::end_event_loop_;
+}
+
int
ACE_ReactorEx::open (size_t size,
int unused,
@@ -1328,7 +1448,7 @@ ACE_ReactorEx::max_notify_iterations (void)
}
// No-op WinSOCK2 methods to help ReactorEx compile
-#if !defined (ACE_HAS_WINSOCK2)
+#if !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0)
int
WSAEventSelect (SOCKET s,
WSAEVENT hEventObject,
@@ -1354,5 +1474,51 @@ WSAEnumNetworkEvents (SOCKET s,
}
#endif /* !defined ACE_HAS_WINSOCK2 */
+#else /* ACE_WIN32 */
+
+ACE_ReactorEx *
+ACE_ReactorEx::instance (void)
+{
+ return NULL;
+}
+
+ACE_ReactorEx *
+ACE_ReactorEx::reactorEx (ACE_ReactorEx *r)
+{
+ return NULL;
+}
+
+void
+ACE_ReactorEx::close_singleton (void)
+{
+}
+
+int
+ACE_Proactor::run_event_loop (void)
+{
+ // not implemented
+ return -1;
+}
+
+int
+ACE_Proactor::run_event_loop (ACE_Time_Value &tv)
+{
+ // not implemented
+ return -1;
+}
+
+int
+ACE_Proactor::end_event_loop (void)
+{
+ // not implemented
+ return -1;
+}
+
+sig_atomic_t
+ACE_Proactor::event_loop_done (void)
+{
+ return sig_atomic_t(1);
+}
+
#endif /* ACE_WIN32 */
diff --git a/ace/ReactorEx.h b/ace/ReactorEx.h
index 2b5151817e4..72ed6028355 100644
--- a/ace/ReactorEx.h
+++ b/ace/ReactorEx.h
@@ -25,6 +25,8 @@
// Forward decl.
class ACE_ReactorEx;
+class ACE_Handle_Set;
+class ACE_Sig_Handler;
class ACE_Export ACE_Wakeup_All_Threads_Handler : public ACE_Event_Handler
// = TITLE
@@ -464,6 +466,33 @@ public:
// added to the <size> parameter which will store handles used for
// internal management purposes.
+ static ACE_ReactorEx *instance (void);
+ // Get pointer to a process-wide <ACE_ReactorEx>.
+
+ static ACE_ReactorEx *instance (ACE_ReactorEx *);
+ // Set pointer to a process-wide <ACE_ReactorEx> and return existing
+ // pointer.
+
+ static void close_singleton (void);
+ // Delete the dynamically allocated Singleton
+
+ // = ReactorEx event loop management methods.
+ static int run_event_loop (void);
+ // Run the event loop until the <ACE_ReactorEx::handle_events>
+ // method returns -1 or the <end_event_loop> method
+ // is invoked.
+
+ static int run_event_loop (ACE_Time_Value &tv);
+ // Run the event loop until the <ACE_ReactorEx::handle_events>
+ // method returns -1, the <end_event_loop> method
+ // is invoked, or the <ACE_Time_Value> expires.
+
+ static int end_event_loop (void);
+ // Instruct the <ACE_ReactorEx::instance()> to terminate its event loop.
+
+ static sig_atomic_t event_loop_done (void);
+ // Report if the <ACE_ReactorEx::instance> event loop is finished.
+
virtual int open (size_t size = DEFAULT_SIZE,
int restart = 0,
ACE_Sig_Handler * = 0,
@@ -825,13 +854,22 @@ protected:
// This flag is used to keep track of whether we are already closed.
private:
+ static ACE_ReactorEx *reactorEx_;
+ // Pointer to a process-wide <ACE_Reactor>.
+
+ static int delete_reactorEx_;
+ // Must delete the <reactor_> if non-0.
+
+ static sig_atomic_t end_event_loop_;
+ // Terminate the reactor-ex event loop.
+
ACE_ReactorEx (const ACE_ReactorEx &);
ACE_ReactorEx &operator = (const ACE_ReactorEx &);
// Deny access since member-wise won't work...
};
// if we don't have WinSOCK2, we need these defined
-#if !defined (ACE_HAS_WINSOCK2)
+#if !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0)
/*
* WinSock 2 extension -- bit values and indices for FD_XXX network events
*/
@@ -877,11 +915,34 @@ public:
int notify (ACE_Event_Handler * = 0,
ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK)
{ return 0; }
+
+ static ACE_ReactorEx *instance (void);
+ // Get pointer to a process-wide <ACE_ReactorEx>.
+
+ static ACE_ReactorEx *instance (ACE_ReactorEx *);
+ // Set pointer to a process-wide <ACE_ReactorEx> and return existing
+ // pointer.
+
+ static void close_singleton (void);
+ // Delete the dynamically allocated Singleton
+
+ static int run_event_loop (void);
+ // Placeholder to enable compilation on non-Win32 platforms
+
+ static int run_event_loop (ACE_Time_Value &tv);
+ // Placeholder to enable compilation on non-Win32 platforms
+
+ static int end_event_loop (void);
+ // Placeholder to enable compilation on non-Win32 platforms
+
+ static sig_atomic_t event_loop_done (void);
+ // Placeholder to enable compilation on non-Win32 platforms
};
#endif /* ACE_WIN32 */
#if defined (__ACE_INLINE__)
+#include "ace/Handle_Set.h"
#include "ace/ReactorEx.i"
#endif /* __ACE_INLINE__ */
#endif /* ACE_REACTOREX_H */
diff --git a/ace/Read_Buffer.cpp b/ace/Read_Buffer.cpp
index c21ee748779..ae6a7b9dae6 100644
--- a/ace/Read_Buffer.cpp
+++ b/ace/Read_Buffer.cpp
@@ -26,7 +26,7 @@ ACE_Read_Buffer::ACE_Read_Buffer (FILE *fp,
{
ACE_TRACE ("ACE_Read_Buffer::ACE_Read_Buffer");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
}
ACE_Read_Buffer::ACE_Read_Buffer (int handle,
@@ -39,7 +39,7 @@ ACE_Read_Buffer::ACE_Read_Buffer (int handle,
ACE_TRACE ("ACE_Read_Buffer::ACE_Read_Buffer");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
}
ACE_Read_Buffer::~ACE_Read_Buffer (void)
diff --git a/ace/Remote_Tokens.cpp b/ace/Remote_Tokens.cpp
index b8efd348746..1165136669b 100644
--- a/ace/Remote_Tokens.cpp
+++ b/ace/Remote_Tokens.cpp
@@ -9,7 +9,7 @@
#include "ace/Remote_Tokens.i"
#endif /* __ACE_INLINE__ */
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
typedef ACE_Thread_Mutex ACE_TSS_CONNECTION_MUTEX;
#else
typedef ACE_Null_Mutex ACE_TSS_CONNECTION_MUTEX;
diff --git a/ace/Remote_Tokens.h b/ace/Remote_Tokens.h
index bfac48e8a0e..6630219ece1 100644
--- a/ace/Remote_Tokens.h
+++ b/ace/Remote_Tokens.h
@@ -25,7 +25,6 @@
#include "ace/Synch_Options.h"
#include "ace/Local_Tokens.h"
#include "ace/Token_Request_Reply.h"
-#include "ace/Synch.h"
class ACE_Export ACE_Remote_Token_Proxy : public ACE_Token_Proxy
// = TITLE
diff --git a/ace/SString.cpp b/ace/SString.cpp
index 73ed95a42a3..8f342479fab 100644
--- a/ace/SString.cpp
+++ b/ace/SString.cpp
@@ -46,7 +46,7 @@ ACE_CString::ACE_CString (const ACE_CString &s)
ACE_TRACE ("ACE_CString::ACE_CString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
if (s.fast_rep ()[0] == '\0')
{
@@ -93,7 +93,7 @@ ACE_CString::ACE_CString (ACE_Allocator *alloc)
ACE_TRACE ("ACE_CString::ACE_CString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
}
// Constructor that actually copies memory.
@@ -104,7 +104,7 @@ ACE_CString::ACE_CString (const char *s, ACE_Allocator *alloc)
ACE_TRACE ("ACE_CString::ACE_CString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
if (s == 0 || s[0] == 0')
{
@@ -129,7 +129,7 @@ ACE_CString::ACE_CString (const ACE_USHORT16 *s, ACE_Allocator *alloc)
ACE_TRACE ("ACE_CString::ACE_CString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
if (s == 0 || s[0] == (ACE_USHORT16) '\0')
{
@@ -159,7 +159,7 @@ ACE_CString::ACE_CString (const char *s,
ACE_TRACE ("ACE_CString::ACE_CString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
if (s == 0 || s[0] == '\0')
{
@@ -316,7 +316,7 @@ ACE_SString::ACE_SString (const ACE_SString &s)
ACE_TRACE ("ACE_SString::ACE_SString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
this->rep_ = (char *) this->allocator_->malloc (s.len_ + 1);
ACE_OS::memcpy ((void *) this->rep_, (const void *) s.rep_, this->len_);
@@ -334,7 +334,7 @@ ACE_SString::ACE_SString (ACE_Allocator *alloc)
ACE_TRACE ("ACE_SString::ACE_SString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
this->len_ = 0;
this->rep_ = (char *) this->allocator_->malloc (this->len_ + 1);
@@ -400,7 +400,7 @@ ACE_SString::ACE_SString (const char *s,
ACE_TRACE ("ACE_SString::ACE_SString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
if (s == 0)
{
@@ -426,7 +426,7 @@ ACE_SString::ACE_SString (const char *s,
ACE_TRACE ("ACE_SString::ACE_SString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
if (s == 0)
{
@@ -482,7 +482,7 @@ ACE_WString::ACE_WString (ACE_Allocator *alloc)
ACE_TRACE ("ACE_WString::ACE_WString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
this->len_ = 0;
this->rep_ = (ACE_USHORT16 *) this->allocator_->malloc ((this->len_ + 1) * sizeof (ACE_USHORT16));
@@ -536,7 +536,7 @@ ACE_WString::ACE_WString (const char *s,
ACE_TRACE ("ACE_WString::ACE_WString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
if (s == 0)
{
@@ -568,7 +568,7 @@ ACE_WString::ACE_WString (const ACE_USHORT16 *s,
ACE_TRACE ("ACE_WString::ACE_WString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
if (s == 0)
{
@@ -598,7 +598,7 @@ ACE_WString::ACE_WString (const ACE_USHORT16 *s,
ACE_TRACE ("ACE_WString::ACE_WString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
if (s == 0)
{
@@ -627,7 +627,7 @@ ACE_WString::ACE_WString (size_t len,
ACE_TRACE ("ACE_WString::ACE_WString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
this->len_ = len;
this->rep_ = (ACE_USHORT16 *) this->allocator_->malloc ((this->len_ + 1) * sizeof (ACE_USHORT16));
@@ -654,7 +654,7 @@ ACE_WString::ACE_WString (const ACE_WString &s)
ACE_TRACE ("ACE_WString::ACE_WString");
if (this->allocator_ == 0)
- this->allocator_ = ACE_Service_Config::alloc ();
+ this->allocator_ = ACE_Allocator::instance ();
this->rep_ = (ACE_USHORT16 *) this->allocator_->malloc ((s.len_ + 1) * sizeof (ACE_USHORT16));
ACE_OS::memcpy ((void *) this->rep_, (const void *) s.rep_,
diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp
index 0a6726eb876..ef50396858c 100644
--- a/ace/Service_Config.cpp
+++ b/ace/Service_Config.cpp
@@ -11,6 +11,12 @@
#include "ace/Service_Record.h"
#include "ace/Containers.h"
#include "ace/Auto_Ptr.h"
+
+#include "ace/Reactor.h"
+#include "ace/Proactor.h"
+#include "ace/ReactorEx.h"
+#include "ace/Thread_Manager.h"
+
#include "ace/Service_Config.h"
#if !defined (__ACE_INLINE__)
@@ -19,11 +25,6 @@
ACE_ALLOC_HOOK_DEFINE(ACE_Service_Config)
-#if defined (ACE_MT_SAFE)
-// Lock the creation of the Singletons.
-static ACE_Thread_Mutex ace_service_config_lock_;
-#endif /* ACE_MT_SAFE */
-
void
ACE_Service_Config::dump (void) const
{
@@ -42,53 +43,6 @@ ACE_SVC_FACTORY_DEFINE (ACE_Service_Manager)
// Set the signal handler to point to the handle_signal() function.
ACE_Sig_Adapter ACE_Service_Config::signal_handler_ (&ACE_Service_Config::handle_signal);
-// Process-wide Service Repository.
-ACE_Service_Repository *ACE_Service_Config::svc_rep_ = 0;
-
-// Controls whether the Service_Repository is deleted when we shut
-// down (we can only delete it safely if we created it!)
-int ACE_Service_Config::delete_svc_rep_ = 0;
-
-// Process-wide Thread Manager.
-ACE_Thread_Manager *ACE_Service_Config::thr_mgr_ = 0;
-
-// Controls whether the Thread_Manager is deleted when we shut down
-// (we can only delete it safely if we created it!)
-int ACE_Service_Config::delete_thr_mgr_ = 0;
-
-// Process-wide ACE_Allocator.
-ACE_Allocator *ACE_Service_Config::allocator_ = 0;
-
-// Controls whether the Allocator is deleted when we shut down (we can
-// only delete it safely if we created it!)
-int ACE_Service_Config::delete_allocator_ = 0;
-
-// Process-wide ACE_Proactor.
-ACE_Proactor *ACE_Service_Config::proactor_ = 0;
-
-// Controls whether the Proactor is deleted when we shut down (we can
-// only delete it safely if we created it!)
-int ACE_Service_Config::delete_proactor_ = 0;
-
-// Process-wide ACE_Reactor.
-ACE_Reactor *ACE_Service_Config::reactor_ = 0;
-
-// Controls whether the Reactor is deleted when we shut down (we can
-// only delete it safely if we created it!)
-int ACE_Service_Config::delete_reactor_ = 0;
-
-// Process-wide ACE_ReactorEx.
-ACE_ReactorEx *ACE_Service_Config::reactorEx_ = 0;
-
-// Controls whether the ReactorEx is deleted when we shut down (we can
-// only delete it safely if we created it!)
-int ACE_Service_Config::delete_reactorEx_ = 0;
-
-// Terminate the eventloop.
-sig_atomic_t ACE_Service_Config::end_reactor_event_loop_ = 0;
-sig_atomic_t ACE_Service_Config::end_proactor_event_loop_ = 0;
-sig_atomic_t ACE_Service_Config::end_reactorEx_event_loop_ = 0;
-
// Trigger a reconfiguration.
sig_atomic_t ACE_Service_Config::reconfig_occurred_ = 0;
@@ -131,204 +85,84 @@ ACE_Allocator *
ACE_Service_Config::alloc (void)
{
ACE_TRACE ("ACE_Service_Config::allocator");
-
- if (ACE_Service_Config::allocator_ == 0)
- {
- // Perform Double-Checked Locking Optimization.
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_service_config_lock_, 0));
-
- if (ACE_Service_Config::allocator_ == 0)
- {
- ACE_NEW_RETURN (ACE_Service_Config::allocator_,
- ACE_New_Allocator,
- 0);
- ACE_Service_Config::delete_allocator_ = 1;
- }
- }
- return ACE_Service_Config::allocator_;
+ return ACE_Allocator::instance ();
}
ACE_Allocator *
ACE_Service_Config::alloc (ACE_Allocator *r)
{
ACE_TRACE ("ACE_Service_Config::allocator");
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_service_config_lock_, 0));
- ACE_Allocator *t = ACE_Service_Config::allocator_;
-
- // We can't safely delete it since we don't know who created it!
- ACE_Service_Config::delete_allocator_ = 0;
-
- ACE_Service_Config::allocator_ = r;
- return t;
+ return ACE_Allocator::instance (r);
}
ACE_Reactor *
ACE_Service_Config::reactor (void)
{
ACE_TRACE ("ACE_Service_Config::reactor");
-
- if (ACE_Service_Config::reactor_ == 0)
- {
- // Perform Double-Checked Locking Optimization.
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_service_config_lock_, 0));
-
- if (ACE_Service_Config::reactor_ == 0)
- {
- ACE_NEW_RETURN (ACE_Service_Config::reactor_, ACE_Reactor, 0);
- ACE_Service_Config::delete_reactor_ = 1;
- }
- }
- return ACE_Service_Config::reactor_;
+ return ACE_Reactor::instance ();
}
ACE_Reactor *
ACE_Service_Config::reactor (ACE_Reactor *r)
{
ACE_TRACE ("ACE_Service_Config::reactor");
-
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_service_config_lock_, 0));
- ACE_Reactor *t = ACE_Service_Config::reactor_;
- // We can't safely delete it since we don't know who created it!
- ACE_Service_Config::delete_reactor_ = 0;
-
- ACE_Service_Config::reactor_ = r;
- return t;
+ return ACE_Reactor::instance (r);
}
ACE_Proactor *
ACE_Service_Config::proactor (size_t threads)
{
ACE_TRACE ("ACE_Service_Config::proactor");
-
- if (ACE_Service_Config::proactor_ == 0)
- {
- // Perform Double-Checked Locking Optimization.
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_service_config_lock_, 0));
-
- if (ACE_Service_Config::proactor_ == 0)
- {
- ACE_NEW_RETURN (ACE_Service_Config::proactor_, ACE_Proactor (threads), 0);
- ACE_Service_Config::delete_proactor_ = 1;
- }
- }
- return ACE_Service_Config::proactor_;
+ return ACE_Proactor::instance (threads);
}
ACE_Proactor *
ACE_Service_Config::proactor (ACE_Proactor *r)
{
ACE_TRACE ("ACE_Service_Config::proactor");
-
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_service_config_lock_, 0));
-
- ACE_Proactor *t = ACE_Service_Config::proactor_;
- // We can't safely delete it since we don't know who created it!
- ACE_Service_Config::delete_proactor_ = 0;
-
- ACE_Service_Config::proactor_ = r;
- return t;
+ return ACE_Proactor::instance (r);
}
ACE_ReactorEx *
ACE_Service_Config::reactorEx (void)
{
ACE_TRACE ("ACE_Service_Config::reactorEx");
-
- if (ACE_Service_Config::reactorEx_ == 0)
- {
- // Perform Double-Checked Locking Optimization.
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_service_config_lock_, 0));
-
- if (ACE_Service_Config::reactorEx_ == 0)
- {
- ACE_NEW_RETURN (ACE_Service_Config::reactorEx_, ACE_ReactorEx, 0);
- ACE_Service_Config::delete_reactorEx_ = 1;
- }
- }
-
- return ACE_Service_Config::reactorEx_;
+ return ACE_ReactorEx::instance ();
}
ACE_ReactorEx *
ACE_Service_Config::reactorEx (ACE_ReactorEx *r)
{
ACE_TRACE ("ACE_Service_Config::reactorEx");
-
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_service_config_lock_, 0));
- ACE_ReactorEx *t = ACE_Service_Config::reactorEx_;
- // We can't safely delete it since we don't know who created it!
- ACE_Service_Config::delete_reactorEx_ = 0;
-
- ACE_Service_Config::reactorEx_ = r;
- return t;
+ return ACE_ReactorEx::instance (r);
}
ACE_Service_Repository *
-ACE_Service_Config::svc_rep (void)
+ACE_Service_Config::svc_rep ()
{
ACE_TRACE ("ACE_Service_Config::svc_rep");
-
- if (ACE_Service_Config::svc_rep_ == 0)
- {
- // Perform Double-Checked Locking Optimization.
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_service_config_lock_, 0));
-
- if (ACE_Service_Config::svc_rep_ == 0)
- {
- ACE_NEW_RETURN (ACE_Service_Config::svc_rep_, ACE_Service_Repository, 0);
- ACE_Service_Config::delete_svc_rep_ = 1;
- }
- }
- return ACE_Service_Config::svc_rep_;
+ return ACE_Service_Repository::instance();
}
ACE_Service_Repository *
ACE_Service_Config::svc_rep (ACE_Service_Repository *s)
{
ACE_TRACE ("ACE_Service_Config::svc_rep");
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_service_config_lock_, 0));
-
- ACE_Service_Repository *t = ACE_Service_Config::svc_rep_;
- // We can't safely delete it since we don't know who created it!
- ACE_Service_Config::delete_svc_rep_ = 0;
-
- ACE_Service_Config::svc_rep_ = s;
- return t;
+ return ACE_Service_Repository::instance (s);
}
ACE_Thread_Manager *
ACE_Service_Config::thr_mgr (void)
{
ACE_TRACE ("ACE_Service_Config::thr_mgr");
-
- if (ACE_Service_Config::thr_mgr_ == 0)
- {
- // Perform Double-Checked Locking Optimization.
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_service_config_lock_, 0));
-
- if (ACE_Service_Config::thr_mgr_ == 0)
- {
- ACE_NEW_RETURN (ACE_Service_Config::thr_mgr_, ACE_Thread_Manager, 0);
- ACE_Service_Config::delete_thr_mgr_ = 1;
- }
- }
-
- return ACE_Service_Config::thr_mgr_;
+ return ACE_Thread_Manager::instance ();
}
ACE_Thread_Manager *
ACE_Service_Config::thr_mgr (ACE_Thread_Manager *tm)
{
ACE_TRACE ("ACE_Service_Config::thr_mgr");
-
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_service_config_lock_, 0));
-
- ACE_Thread_Manager *t = ACE_Service_Config::thr_mgr_;
- // We can't safely delete it since we don't know who created it!
- ACE_Service_Config::delete_thr_mgr_ = 0;
-
- ACE_Service_Config::thr_mgr_ = tm;
- return t;
+ return ACE_Thread_Manager::instance (tm);
}
// Totally remove <svc_name> from the daemon by removing it from the
@@ -338,7 +172,7 @@ int
ACE_Service_Config::remove (const char svc_name[])
{
ACE_TRACE ("ACE_Service_Config::remove");
- return ACE_Service_Config::svc_rep ()->remove (svc_name);
+ return ACE_Service_Repository::instance ()->remove (svc_name);
}
// Suspend SVC_NAME. Note that this will not unlink the service from
@@ -351,7 +185,7 @@ int
ACE_Service_Config::suspend (const char svc_name[])
{
ACE_TRACE ("ACE_Service_Config::suspend");
- return ACE_Service_Config::svc_rep ()->suspend (svc_name);
+ return ACE_Service_Repository::instance ()->suspend (svc_name);
}
// Resume a SVC_NAME that was previously suspended or has not yet
@@ -361,7 +195,7 @@ int
ACE_Service_Config::resume (const char svc_name[])
{
ACE_TRACE ("ACE_Service_Config::resume");
- return ACE_Service_Config::svc_rep ()->resume (svc_name);
+ return ACE_Service_Repository::instance ()->resume (svc_name);
}
// Initialize the Service Repository. Note that this *must*
@@ -378,36 +212,19 @@ ACE_Service_Config::ACE_Service_Config (int ignore_static_svcs,
ACE_Service_Config::signum_ = signum;
// Initialize the Service Repository.
-
- if (ACE_Service_Config::svc_rep_ == 0)
- {
- ACE_NEW (ACE_Service_Config::svc_rep_,
- ACE_Service_Repository (size));
-
- // We created it, so we own it!
- ACE_Service_Config::delete_svc_rep_ = 1;
- }
+ ACE_Service_Repository::instance (size);
// Initialize the ACE_Reactor (the ACE_Reactor should be the same
// size as the ACE_Service_Repository).
-
- if (ACE_Service_Config::reactor_ == 0)
- {
- ACE_NEW (ACE_Service_Config::reactor_,
- ACE_Reactor (size));
-
- // We created it, so we own it!
- ACE_Service_Config::delete_reactor_ = 1;
- }
+ ACE_Reactor::instance (size);
// There's no point in dealing with this on NT since it doesn't really
// support signals very well...
#if !defined (ACE_LACKS_UNIX_SIGNALS)
// This really ought to be a Singleton I suspect...
- if (ACE_Service_Config::reactor_->register_handler
- (ACE_Service_Config::signum_,
- &ACE_Service_Config::signal_handler_) == -1)
+ if (ACE_Reactor::instance ()->register_handler (ACE_Service_Config::signum_,
+ &ACE_Service_Config::signal_handler_) == -1)
ACE_ERROR ((LM_ERROR, "can't register signal handler\n"));
#endif /* ACE_LACKS_UNIX_SIGNALS */
}
@@ -443,7 +260,7 @@ ACE_Service_Config::parse_args (int argc, char *argv[])
#if !defined (ACE_LACKS_UNIX_SIGNALS)
ACE_Service_Config::signum_ = ACE_OS::atoi (getopt.optarg);
- if (ACE_Service_Config::reactor ()->register_handler
+ if (ACE_Reactor::instance()->register_handler
(ACE_Service_Config::signum_,
&ACE_Service_Config::signal_handler_) == -1)
ACE_ERROR ((LM_ERROR, "cannot obtain signal handler\n"));
@@ -468,8 +285,8 @@ ACE_Service_Config::initialize (const char svc_name[],
ACE_DEBUG ((LM_DEBUG, "opening static service %s\n", svc_name));
- if (ACE_Service_Config::svc_rep ()->find
- (svc_name, (const ACE_Service_Record **) &srp) == -1)
+ if (ACE_Service_Repository::instance()->find (svc_name,
+ (const ACE_Service_Record **) &srp) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%s not found\n", svc_name), -1);
else if (srp->type ()->init (args.argc (), args.argv ()) == -1)
@@ -494,7 +311,7 @@ ACE_Service_Config::initialize (const ACE_Service_Record *sr,
ACE_DEBUG ((LM_DEBUG, "opening dynamic service %s\n", sr->name ()));
- if (ACE_Service_Config::svc_rep ()->insert (sr) == -1)
+ if (ACE_Service_Repository::instance()->insert (sr) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "insertion failed, %p\n", sr->name ()), -1);
else if (sr->type ()->init (args.argc (), args.argv ()) == -1)
@@ -574,7 +391,7 @@ ACE_Service_Config::load_static_svcs (void)
ACE_NEW_RETURN (sr, ACE_Service_Record (ssd->name_, stp,
0, ssd->active_), -1);
- if (ACE_Service_Config::svc_rep ()->insert (sr) == -1)
+ if (ACE_Service_Repository::instance()->insert (sr) == -1)
return -1;
}
return 0;
@@ -600,26 +417,11 @@ ACE_Service_Config::open (const char program_name[])
// Initialize the Service Repository (this will still work if user
// forgets to define an object of type ACE_Service_Config).
-
- if (ACE_Service_Config::svc_rep_ == 0)
- {
- ACE_NEW_RETURN (ACE_Service_Config::svc_rep_,
- ACE_Service_Repository (ACE_Service_Config::MAX_SERVICES), -1);
-
- // We created it, so we own it!
- ACE_Service_Config::delete_svc_rep_ = 1;
- }
+ ACE_Service_Repository::instance(ACE_Service_Config::MAX_SERVICES);
// Initialize the ACE_Reactor (the ACE_Reactor should be the same
// size as the ACE_Service_Repository).
-
- if (ACE_Service_Config::reactor_ == 0)
- {
- ACE_NEW_RETURN (ACE_Service_Config::reactor_,
- ACE_Reactor (ACE_Service_Config::MAX_SERVICES), -1);
- // We created it, so we own it!
- ACE_Service_Config::delete_reactor_ = 1;
- }
+ ACE_Reactor::instance(ACE_Service_Config::MAX_SERVICES);
// Register ourselves to receive reconfiguration requests via
// signals!
@@ -688,18 +490,7 @@ ACE_Service_Config::run_reactor_event_loop (void)
{
ACE_TRACE ("ACE_Service_Config::run_reactor_event_loop");
- while (ACE_Service_Config::end_reactor_event_loop_ == 0)
- {
- int result = ACE_Service_Config::reactor ()->handle_events ();
-
- if (ACE_Service_Config::reconfig_occurred_)
- ACE_Service_Config::reconfigure ();
-
- else if (result == -1)
- return -1;
- }
- /* NOTREACHED */
- return 0;
+ return ACE_Reactor::run_event_loop ();
}
// Run the event loop until the <ACE_Reactor::handle_events>
@@ -711,18 +502,23 @@ ACE_Service_Config::run_reactor_event_loop (ACE_Time_Value &tv)
{
ACE_TRACE ("ACE_Service_Config::run_reactor_event_loop");
- while (ACE_Service_Config::end_reactor_event_loop_ == 0)
- {
- int result = ACE_Service_Config::reactor ()->handle_events (tv);
+ return ACE_Reactor::run_event_loop (tv);
+}
- if (ACE_Service_Config::reconfig_occurred_)
- ACE_Service_Config::reconfigure ();
- else if (result <= 0)
- return result;
- }
+/* static */
+int
+ACE_Service_Config::end_reactor_event_loop (void)
+{
+ ACE_TRACE ("ACE_Service_Config::end_reactor_event_loop");
+ return ACE_Reactor::end_event_loop ();
+}
- /* NOTREACHED */
- return 0;
+/* static */
+sig_atomic_t
+ACE_Service_Config::reactor_event_loop_done (void)
+{
+ ACE_TRACE ("ACE_Service_Config::reactor_event_loop_done");
+ return ACE_Reactor::event_loop_done ();
}
// Tidy up and perform last rites on a terminating ACE_Service_Config.
@@ -731,15 +527,12 @@ ACE_Service_Config::close (void)
{
ACE_TRACE ("ACE_Service_Config::close");
- if (ACE_Service_Config::svc_rep_ != 0)
- {
- ACE_DEBUG ((LM_SHUTDOWN, "shutting down daemon %n\n"));
+ ACE_DEBUG ((LM_SHUTDOWN, "shutting down daemon %n\n"));
- // ACE_Service_Config must be deleted before the Singletons are
- // closed so that an object's fini() method may reference a
- // valid ACE_Reactor.
- ACE_Service_Config::close_svcs ();
- }
+ // ACE_Service_Config must be deleted before the Singletons are
+ // closed so that an object's fini() method may reference a
+ // valid ACE_Reactor.
+ ACE_Service_Config::close_svcs ();
// The Singletons can be used independently of the services.
// Therefore, this call must go out here.
@@ -752,11 +545,7 @@ ACE_Service_Config::close_svcs (void)
{
ACE_TRACE ("ACE_Service_Config::close_svcs");
- if (ACE_Service_Config::delete_svc_rep_)
- {
- delete ACE_Service_Config::svc_rep_;
- ACE_Service_Config::svc_rep_ = 0;
- }
+ ACE_Service_Repository::close_singleton ();
return 0;
}
@@ -766,35 +555,12 @@ ACE_Service_Config::close_singletons (void)
{
ACE_TRACE ("ACE_Service_Config::close_singletons");
- if (ACE_Service_Config::delete_reactor_)
- {
- delete ACE_Service_Config::reactor_;
- ACE_Service_Config::reactor_ = 0;
- }
-
- if (ACE_Service_Config::delete_proactor_)
- {
- delete ACE_Service_Config::proactor_;
- ACE_Service_Config::proactor_ = 0;
- }
-
- if (ACE_Service_Config::delete_reactorEx_)
- {
- delete ACE_Service_Config::reactorEx_;
- ACE_Service_Config::reactorEx_ = 0;
- }
-
- if (ACE_Service_Config::delete_thr_mgr_)
- {
- delete ACE_Service_Config::thr_mgr_;
- ACE_Service_Config::thr_mgr_ = 0;
- }
+ ACE_Reactor::close_singleton ();
+ ACE_ReactorEx::close_singleton ();
+ ACE_Proactor::close_singleton ();
+ ACE_Thread_Manager::close_singleton ();
+ ACE_Allocator::close_singleton ();
- if (ACE_Service_Config::delete_allocator_)
- {
- delete ACE_Service_Config::allocator_;
- ACE_Service_Config::allocator_ = 0;
- }
return 0;
}
@@ -807,44 +573,11 @@ ACE_Service_Config::~ACE_Service_Config (void)
ACE_Service_Config::close ();
}
-/* static */
-int
-ACE_Service_Config::end_reactor_event_loop (void)
-{
- ACE_TRACE ("ACE_Service_Config::end_reactor_event_loop");
- ACE_Service_Config::end_reactor_event_loop_ = 1;
-
- // Send a notification, but don't block if there's no one to receive
- // it.
- return ACE_Service_Config::reactor ()->notify
- (0, ACE_Event_Handler::NULL_MASK, (ACE_Time_Value *) &ACE_Time_Value::zero);
-}
-
-/* static */
-sig_atomic_t
-ACE_Service_Config::reactor_event_loop_done (void)
-{
- ACE_TRACE ("ACE_Service_Config::end_proactor_event_loop");
- return ACE_Service_Config::end_reactor_event_loop_;
-}
-
int
ACE_Service_Config::run_proactor_event_loop (void)
{
ACE_TRACE ("ACE_Service_Config::run_proactor_event_loop");
-
- while (ACE_Service_Config::end_proactor_event_loop_ == 0)
- {
- int result = ACE_Service_Config::proactor ()->handle_events ();
-
- if (ACE_Service_Config::reconfig_occurred_)
- ACE_Service_Config::reconfigure ();
-
- else if (result == -1)
- return -1;
- }
- /* NOTREACHED */
- return 0;
+ return ACE_Proactor::run_event_loop ();
}
// Handle events for -tv- time. handle_events updates -tv- to reflect
@@ -853,38 +586,22 @@ int
ACE_Service_Config::run_proactor_event_loop (ACE_Time_Value &tv)
{
ACE_TRACE ("ACE_Service_Config::run_proactor_event_loop");
-
- while ((ACE_Service_Config::end_proactor_event_loop_ == 0) &&
- (tv != ACE_Time_Value::zero))
- {
- int result = ACE_Service_Config::proactor ()->handle_events (tv);
- if (ACE_Service_Config::reconfig_occurred_)
- ACE_Service_Config::reconfigure ();
-
- // An error has occurred.
- else if (result == -1)
- return result;
- }
-
- /* NOTREACHED */
- return 0;
+ return ACE_Proactor::run_event_loop (tv);
}
int
ACE_Service_Config::end_proactor_event_loop (void)
{
ACE_TRACE ("ACE_Service_Config::end_proactor_event_loop");
- ACE_Service_Config::end_proactor_event_loop_ = 1;
- // ACE_Service_Config::proactor ()->notify ();
- return 0;
+ return ACE_Proactor::end_event_loop ();
}
/* static */
sig_atomic_t
ACE_Service_Config::proactor_event_loop_done (void)
{
- ACE_TRACE ("ACE_Service_Config::end_proactor_event_loop");
- return ACE_Service_Config::end_proactor_event_loop_;
+ ACE_TRACE ("ACE_Service_Config::proactor_event_loop_done");
+ return ACE_Proactor::event_loop_done ();
}
// ************************************************************
@@ -893,19 +610,7 @@ int
ACE_Service_Config::run_reactorEx_event_loop (void)
{
ACE_TRACE ("ACE_Service_Config::run_reactorEx_event_loop");
-
- while (ACE_Service_Config::end_reactorEx_event_loop_ == 0)
- {
- int result = ACE_Service_Config::reactorEx ()->handle_events ();
-
- if (ACE_Service_Config::reconfig_occurred_)
- ACE_Service_Config::reconfigure ();
-
- else if (result == -1)
- return -1;
- }
- /* NOTREACHED */
- return 0;
+ return ACE_ReactorEx::run_event_loop ();
}
@@ -913,35 +618,22 @@ int
ACE_Service_Config::run_reactorEx_event_loop (ACE_Time_Value &tv)
{
ACE_TRACE ("ACE_Service_Config::run_reactorEx_event_loop");
-
- while ((ACE_Service_Config::end_reactorEx_event_loop_ == 0) &&
- (tv != ACE_Time_Value::zero))
- {
- int result = ACE_Service_Config::reactorEx ()->handle_events (tv);
- if (ACE_Service_Config::reconfig_occurred_)
- ACE_Service_Config::reconfigure ();
- else if (result == -1)
- return result;
- }
-
- /* NOTREACHED */
- return 0;
+ return ACE_ReactorEx::run_event_loop (tv);
}
int
ACE_Service_Config::end_reactorEx_event_loop (void)
{
ACE_TRACE ("ACE_Service_Config::end_reactorEx_event_loop");
- ACE_Service_Config::end_reactorEx_event_loop_ = 1;
- return ACE_Service_Config::reactorEx ()->notify ();
+ return ACE_ReactorEx::end_event_loop ();
}
/* static */
sig_atomic_t
ACE_Service_Config::reactorEx_event_loop_done (void)
{
- ACE_TRACE ("ACE_Service_Config::end_reactorEx_event_loop");
- return ACE_Service_Config::end_reactorEx_event_loop_;
+ ACE_TRACE ("ACE_Service_Config::reactorEx_event_loop_done");
+ return ACE_ReactorEx::event_loop_done ();
}
// ************************************************************
diff --git a/ace/Service_Config.h b/ace/Service_Config.h
index 1e196cc8246..bd933422f26 100644
--- a/ace/Service_Config.h
+++ b/ace/Service_Config.h
@@ -18,7 +18,7 @@
#define ACE_SERVICE_CONFIG_H
#include "ace/Service_Object.h"
-#include "ace/Thread_Manager.h"
+//#include "ace/Thread_Manager.h"
#include "ace/Signal.h"
#include "ace/Containers.h"
@@ -29,6 +29,7 @@ class ACE_Allocator;
class ACE_Reactor;
class ACE_Proactor;
class ACE_ReactorEx;
+class ACE_Thread_Manager;
extern "C"
{
@@ -115,53 +116,77 @@ public:
static int run_reactor_event_loop (void);
// Run the event loop until the <ACE_Reactor::handle_events> method
// returns -1 or the <end_reactor_event_loop> method is invoked.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Reactor::run_event_loop() instead.
static int run_reactor_event_loop (ACE_Time_Value &tv);
// Run the event loop until the <ACE_Reactor::handle_events> method
// returns -1, the <end_reactor_event_loop> method is invoked, or the
// <ACE_Time_Value> expires.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Reactor::run_event_loop() instead.
static int end_reactor_event_loop (void);
// Instruct the <ACE_Service_Config> to terminate its event loop and
- // notifies the <ACE_Service_Config::reactor> so that it can wake up
+ // notifies the <ACE_Reactor::instance> so that it can wake up
// and close down gracefully.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Reactor::end_event_loop() instead.
static sig_atomic_t reactor_event_loop_done (void);
// Report if the Reactor's event loop is finished.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Reactor::event_loop_done() instead.
// = Proactor event loop management methods.
static int run_proactor_event_loop (void);
// Run the event loop until the <ACE_Proactor::handle_events>
// method returns -1 or the <end_proactor_event_loop> method
// is invoked.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Proactor::run_event_loop() instead.
static int run_proactor_event_loop (ACE_Time_Value &tv);
// Run the event loop until the <ACE_Proactor::handle_events>
// method returns -1, the <end_proactor_event_loop> method
// is invoked, or the <ACE_Time_Value> expires.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Proactor::run_event_loop() instead.
static int end_proactor_event_loop (void);
// Instruct the <ACE_Service_Config> to terminate its event loop.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Proactor::end_event_loop() instead.
static sig_atomic_t proactor_event_loop_done (void);
// Report if the proactor event loop is finished.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Proactor::event_loop_done() instead.
// = ReactorEx event loop management methods.
static int run_reactorEx_event_loop (void);
// Run the event loop until the <ACE_ReactorEx::handle_events>
// method returns -1 or the <end_reactorEx_event_loop> method
// is invoked.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_ReactorEx::run_event_loop() instead.
static int run_reactorEx_event_loop (ACE_Time_Value &tv);
// Run the event loop until the <ACE_ReactorEx::handle_events>
// method returns -1, the <end_reactorEx_event_loop> method
// is invoked, or the <ACE_Time_Value> expires.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_ReactorEx::run_event_loop() instead.
static int end_reactorEx_event_loop (void);
// Instruct the <ACE_Service_Config> to terminate its event loop.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_ReactorEx::end_event_loop() instead.
static sig_atomic_t reactorEx_event_loop_done (void);
// Report if the ReactorEx event loop is finished.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_ReactorEx::event_loop_done() instead.
static sig_atomic_t reconfig_occurred (void);
// True if reconfiguration occurred.
@@ -169,6 +194,9 @@ public:
static void reconfig_occurred (sig_atomic_t);
// Indicate that reconfiguration occurred.
+ static void reconfigure (void);
+ // Perform the reconfiguration process.
+
// = The following methods are static in order to enforce Singleton
// semantics for the Reactor, Service_Repository, Thread_Manager,
// Acceptor/Connector Strategy factory, Proactor, and ReactorEx.
@@ -182,47 +210,71 @@ public:
static ACE_Reactor *reactor (void);
// Get pointer to a process-wide <ACE_Reactor>.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Reactor::instance() instead.
static ACE_Reactor *reactor (ACE_Reactor *);
// Set pointer to a process-wide <ACE_Reactor> and return existing
// pointer.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Reactor::instance() instead.
static ACE_Proactor *proactor (size_t threads = 0);
// Get pointer to a process-wide <ACE_Proactor>. <threads> should
// be part of another method. It's only here because I'm just a
// grad student and not in charge. No, I'm not bitter about this.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Proactor::instance() instead.
static ACE_Proactor *proactor (ACE_Proactor *);
// Set pointer to a process-wide <ACE_Proactor> and return existing
// pointer.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Proactor::instance() instead.
static ACE_ReactorEx *reactorEx (void);
// Get pointer to a process-wide <ACE_ReactorEx>.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_ReactorEx::instance() instead.
static ACE_ReactorEx *reactorEx (ACE_ReactorEx *);
// Set pointer to a process-wide <ACE_ReactorEx> and return existing
// pointer.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_ReactorEx::instance() instead.
static ACE_Service_Repository *svc_rep (void);
// Get pointer to a process-wide <ACE_Service_Repository>.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Service_Repository::instance() instead.
static ACE_Service_Repository *svc_rep (ACE_Service_Repository *);
// Set pointer to a process-wide <ACE_Service_Repository> and return
// existing pointer.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Service_Repository::instance() instead.
static ACE_Thread_Manager *thr_mgr (void);
// Get pointer to a process-wide <ACE_Thread_Manager>.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Thread_Manager::instance() instead.
static ACE_Thread_Manager *thr_mgr (ACE_Thread_Manager *);
// Set pointer to a process-wide <ACE_Thread_Manager> and return
// existing pointer.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Thread_Manager::instance() instead.
static ACE_Allocator *alloc (void);
// Get pointer to a default <ACE_Allocator>.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Allocator::instance() instead.
static ACE_Allocator *alloc (ACE_Allocator *);
// Set pointer to a process-wide <ACE_Allocator> and return existing
// pointer.
+ // DO NOT USE THIS METHOD. It may be unsupported in future releases.
+ // Use ACE_Allocator::instance() instead.
// = Member functions used by various other parts
// of the Service Configurator class category.
@@ -263,9 +315,6 @@ protected:
static void parse_args (int, char *[]);
// Handle the command-line options intended for the <ACE_Service_Config>.
- static void reconfigure (void);
- // Perform the reconfiguration process.
-
static int start_daemon (void);
// Become a daemon.
@@ -276,42 +325,6 @@ protected:
// Handles signals to trigger reconfigurations.
private:
- static ACE_Service_Repository *svc_rep_;
- // Pointer to a process-wide <ACE_Service_Repository>.
-
- static int delete_svc_rep_;
- // Must delete the <svc_rep_> if non-0.
-
- static ACE_Thread_Manager *thr_mgr_;
- // Pointer to a process-wide <ACE_Thread_Manager>.
-
- static int delete_thr_mgr_;
- // Must delete the <thr_mgr_> if non-0.
-
- static ACE_Allocator *allocator_;
- // Pointer to a process-wide <ACE_Allocator> instance.
-
- static int delete_allocator_;
- // Must delete the <allocator_> if non-0.
-
- static ACE_Proactor *proactor_;
- // Pointer to a process-wide <ACE_Reactor>.
-
- static int delete_proactor_;
- // Must delete the <proactor_> if non-0.
-
- static ACE_ReactorEx *reactorEx_;
- // Pointer to a process-wide <ACE_Reactor>.
-
- static int delete_reactorEx_;
- // Must delete the <proactor_> if non-0.
-
- static ACE_Reactor *reactor_;
- // Pointer to a process-wide <ACE_Reactor>.
-
- static int delete_reactor_;
- // Must delete the <reactor_> if non-0.
-
static const char *service_config_file_;
// Name of service configuration file.
@@ -321,15 +334,6 @@ private:
//static ACE_Static_Svc_Descriptor service_list_[];
// List of statically linked services.
- static sig_atomic_t end_reactor_event_loop_;
- // Terminate the event loop.
-
- static sig_atomic_t end_proactor_event_loop_;
- // Terminate the proactor event loop.
-
- static sig_atomic_t end_reactorEx_event_loop_;
- // Terminate the proactor event loop.
-
static sig_atomic_t reconfig_occurred_;
// True if reconfiguration occurred.
@@ -350,6 +354,8 @@ private:
#endif /* __ACE_INLINE__ */
// These must go here to avoid circular includes...
+// (only left here for to not break applications
+// which rely on this - no real need any longer)
#include "ace/Reactor.h"
#include "ace/Proactor.h"
#include "ace/ReactorEx.h"
diff --git a/ace/Service_Main.cpp b/ace/Service_Main.cpp
index 14e8fdbcd0b..cddca791ed1 100644
--- a/ace/Service_Main.cpp
+++ b/ace/Service_Main.cpp
@@ -7,6 +7,7 @@
#define ACE_BUILD_DLL
#include "ace/Service_Config.h"
+#include "ace/Reactor.h"
int
sc_main (int argc, char *argv[])
@@ -18,15 +19,15 @@ sc_main (int argc, char *argv[])
ACE_ERROR ((LM_ERROR, "%p\n%a", "open", 1));
// Create an adapter to end the event loop.
- ACE_Sig_Adapter sa ((ACE_Sig_Handler_Ex) ACE_Service_Config::end_reactor_event_loop);
+ ACE_Sig_Adapter sa ((ACE_Sig_Handler_Ex) ACE_Reactor::end_event_loop);
// Register a signal handler.
- ACE_Service_Config::reactor ()->register_handler (SIGINT, &sa);
+ ACE_Reactor::instance()->register_handler (SIGINT, &sa);
// Run forever, performing the configured services until we are shut
// down by a SIGINT/SIGQUIT signal.
- daemon.run_reactor_event_loop ();
+ ACE_Reactor::run_event_loop ();
return 0;
}
diff --git a/ace/Service_Manager.cpp b/ace/Service_Manager.cpp
index 02f6e81bd91..0590c5eac4b 100644
--- a/ace/Service_Manager.cpp
+++ b/ace/Service_Manager.cpp
@@ -35,14 +35,14 @@ int
ACE_Service_Manager::suspend (void)
{
ACE_TRACE ("ACE_Service_Manager::suspend");
- return ACE_Service_Config::reactor ()->suspend_handler (this);
+ return ACE_Reactor::instance ()->suspend_handler (this);
}
int
ACE_Service_Manager::resume (void)
{
ACE_TRACE ("ACE_Service_Manager::resume");
- return ACE_Service_Config::reactor ()->resume_handler (this);
+ return ACE_Reactor::instance ()->resume_handler (this);
}
int
@@ -100,7 +100,7 @@ ACE_Service_Manager::init (int argc, char *argv[])
if (this->open (local_addr) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
- else if (ACE_Service_Config::reactor ()->register_handler
+ else if (ACE_Reactor::instance ()->register_handler
(this, ACE_Event_Handler::ACCEPT_MASK) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "registering service with ACE_Reactor\n"), -1);
return 0;
@@ -119,7 +119,7 @@ ACE_Service_Manager::fini (void)
ACE_TRACE ("ACE_Service_Manager::fini");
if (this->get_handle () != ACE_INVALID_HANDLE)
- return ACE_Service_Config::reactor ()->remove_handler
+ return ACE_Reactor::instance ()->remove_handler
(this, ACE_Event_Handler::ACCEPT_MASK);
return 0;
}
@@ -147,7 +147,7 @@ int
ACE_Service_Manager::list_services (void)
{
ACE_TRACE ("ACE_Service_Manager::list_services");
- ACE_Service_Repository_Iterator sri (*ACE_Service_Config::svc_rep ());
+ ACE_Service_Repository_Iterator sri (*ACE_Service_Repository::instance ());
for (const ACE_Service_Record *sr;
sri.next (sr) != 0;
@@ -191,7 +191,7 @@ ACE_Service_Manager::reconfigure_services (void)
#endif /* 0 */
// Flag the main event loop that a reconfiguration should occur.
- // The next trip through the ACE_Service_Config::run_reactor_event_loop()
+ // The next trip through the ACE_Reactor::run_event_loop()
// should pick this up and cause a reconfiguration!
ACE_Service_Config::reconfig_occurred ((sig_atomic_t) 1);
return this->client_stream_.send_n ("done\n", sizeof ("done\n"));
@@ -247,19 +247,18 @@ ACE_Service_Manager::handle_input (ACE_HANDLE)
*p = '\0';
ACE_Event_Handler *old_signal_handler = 0;
- ACE_Service_Config::reactor ()->register_handler (SIGPIPE, this, 0,
- &old_signal_handler);
-
+ ACE_Reactor::instance ()->register_handler (SIGPIPE, this, 0,
+ &old_signal_handler);
+
if (ACE_OS::strcmp (request, "help") == 0)
this->list_services ();
else if (ACE_OS::strcmp (request, "reconfigure") == 0)
this->reconfigure_services ();
-
+
// Additional management services may be handled here...
// Restore existing SIGPIPE handler
- ACE_Service_Config::reactor ()->register_handler
- (SIGPIPE, old_signal_handler);
+ ACE_Reactor::instance ()->register_handler (SIGPIPE, old_signal_handler);
}
}
if (this->client_stream_.close () == -1 && this->debug_)
diff --git a/ace/Service_Repository.cpp b/ace/Service_Repository.cpp
index c614b638dc0..b6e5f0a0aae 100644
--- a/ace/Service_Repository.cpp
+++ b/ace/Service_Repository.cpp
@@ -10,6 +10,18 @@
ACE_ALLOC_HOOK_DEFINE(ACE_Service_Repository)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+// Lock the creation of the Singletons.
+static ACE_Thread_Mutex ace_service_repository_lock_;
+#endif /* ACE_MT_SAFE */
+
+// Process-wide Service Repository.
+ACE_Service_Repository *ACE_Service_Repository::svc_rep_ = 0;
+
+// Controls whether the Service_Repository is deleted when we shut
+// down (we can only delete it safely if we created it!)
+int ACE_Service_Repository::delete_svc_rep_ = 0;
+
void
ACE_Service_Repository::dump (void) const
{
@@ -24,6 +36,54 @@ ACE_Service_Repository::ACE_Service_Repository (void)
ACE_TRACE ("ACE_Service_Repository::ACE_Service_Repository");
}
+ACE_Service_Repository *
+ACE_Service_Repository::instance (int size /* = ACE_Service_Repository::DEFAULT_SIZE */)
+{
+ ACE_TRACE ("ACE_Service_Config::instance");
+
+ if (ACE_Service_Repository::svc_rep_ == 0)
+ {
+ // Perform Double-Checked Locking Optimization.
+ ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_service_repository_lock_, 0));
+
+ if (ACE_Service_Repository::svc_rep_ == 0)
+ {
+ ACE_NEW_RETURN (ACE_Service_Repository::svc_rep_, ACE_Service_Repository (size), 0);
+ ACE_Service_Repository::delete_svc_rep_ = 1;
+ }
+ }
+ return ACE_Service_Repository::svc_rep_;
+}
+
+ACE_Service_Repository *
+ACE_Service_Repository::instance (ACE_Service_Repository *s)
+{
+ ACE_TRACE ("ACE_Service_Repository::instance");
+ ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_service_repository_lock_, 0));
+
+ ACE_Service_Repository *t = ACE_Service_Repository::svc_rep_;
+ // We can't safely delete it since we don't know who created it!
+ ACE_Service_Repository::delete_svc_rep_ = 0;
+
+ ACE_Service_Repository::svc_rep_ = s;
+ return t;
+}
+
+void
+ACE_Service_Repository::close_singleton (void)
+{
+ ACE_TRACE ("ACE_Service_Repository::close_singleton");
+
+ ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, ace_service_repository_lock_));
+
+ if (ACE_Service_Repository::delete_svc_rep_)
+ {
+ delete ACE_Service_Repository::svc_rep_;
+ ACE_Service_Repository::svc_rep_ = 0;
+ ACE_Service_Repository::delete_svc_rep_ = 0;
+ }
+}
+
// Initialize the Repository to a clean slate.
int
diff --git a/ace/Service_Repository.h b/ace/Service_Repository.h
index 26ceeb868e5..0764cb8ab4d 100644
--- a/ace/Service_Repository.h
+++ b/ace/Service_Repository.h
@@ -34,6 +34,16 @@ public:
ACE_Service_Repository (int size);
// Initialize the repository.
+ static ACE_Service_Repository *instance (int size = ACE_Service_Repository::DEFAULT_SIZE);
+ // Get pointer to a process-wide <ACE_Service_Repository>.
+
+ static ACE_Service_Repository *instance (ACE_Service_Repository *);
+ // Set pointer to a process-wide <ACE_Service_Repository> and return
+ // existing pointer.
+
+ static void close_singleton (void);
+ // Delete the dynamically allocated Singleton
+
int open (int size = DEFAULT_SIZE);
// Initialize the repository.
@@ -91,7 +101,14 @@ private:
int total_size_;
// Maximum number of service.
-#if defined (ACE_MT_SAFE)
+ static ACE_Service_Repository *svc_rep_;
+ // Pointer to a process-wide <ACE_Service_Repository>.
+
+ static int delete_svc_rep_;
+ // Must delete the <svc_rep_> if non-0.
+
+
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
ACE_Thread_Mutex lock_;
// Synchronization variable for the MT_SAFE Repository
#endif /* ACE_MT_SAFE */
diff --git a/ace/Signal.cpp b/ace/Signal.cpp
index efd82ce11bd..ad96314cc5a 100644
--- a/ace/Signal.cpp
+++ b/ace/Signal.cpp
@@ -2,6 +2,7 @@
// $Id$
#define ACE_BUILD_DLL
+#include "ace/Synch_T.h"
#include "ace/Signal.h"
#if !defined (__ACE_INLINE__)
@@ -39,7 +40,7 @@ static ACE_SignalHandler ace_signal_handlers_dispatcher = ACE_SignalHandler (ACE
#endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */
#endif /* ACE_HAS_SIG_C_FUNC */
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
ACE_Recursive_Thread_Mutex ACE_Sig_Handler::ace_sig_handler_lock_;
#endif /* ACE_MT_SAFE */
diff --git a/ace/Signal.h b/ace/Signal.h
index d289e6869ba..04553fbc0f2 100644
--- a/ace/Signal.h
+++ b/ace/Signal.h
@@ -219,7 +219,7 @@ protected:
static sig_atomic_t sig_pending_;
// Keeps track of whether a signal is pending.
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
static ACE_Recursive_Thread_Mutex ace_sig_handler_lock_;
#endif /* ACE_MT_SAFE */
diff --git a/ace/Strategies_T.cpp b/ace/Strategies_T.cpp
index 614fccae285..11e9f9d7f36 100644
--- a/ace/Strategies_T.cpp
+++ b/ace/Strategies_T.cpp
@@ -546,10 +546,10 @@ ACE_Scheduling_Strategy<SVC_HANDLER>::ACE_Scheduling_Strategy (SVC_HANDLER *sche
ACE_NEW (this->scheduler_, SVC_HANDLER);
if (this->scheduler_->thr_mgr () == 0)
- this->scheduler_->thr_mgr (ACE_Service_Config::thr_mgr ());
+ this->scheduler_->thr_mgr (ACE_Thread_Manager::instance ());
if (this->scheduler_->reactor () == 0)
- this->scheduler_->reactor (ACE_Service_Config::reactor ());
+ this->scheduler_->reactor (ACE_Reactor::instance ());
this->delete_scheduler_ = 1;
}
diff --git a/ace/Svc_Handler.cpp b/ace/Svc_Handler.cpp
index 49a5532d0d5..e17de6d735b 100644
--- a/ace/Svc_Handler.cpp
+++ b/ace/Svc_Handler.cpp
@@ -15,7 +15,7 @@
#define PR_ST_1 ACE_PEER_STREAM_1
#define PR_ST_2 ACE_PEER_STREAM_2
-#if defined (ACE_MT_SAFE) && !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) && !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
// Lock the creation of the Singleton.
template <PR_ST_1, ACE_SYNCH_1>
ACE_Thread_Mutex ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_2>::ace_svc_handler_lock_;
@@ -26,7 +26,7 @@ ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_2>::instance (void)
{
ACE_TRACE ("ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_2>::allocated");
-#if defined (ACE_MT_SAFE) && defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) && defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
// Lock the creation of the Singleton. This should be inside of
// ACE_Svc_Handler, but GNU G++ is too lame to handle this...
static ACE_Thread_Mutex ace_svc_handler_lock_;
diff --git a/ace/Svc_Handler.h b/ace/Svc_Handler.h
index 16a88f61ad4..f83c7a5f8d1 100644
--- a/ace/Svc_Handler.h
+++ b/ace/Svc_Handler.h
@@ -46,7 +46,7 @@ public:
// = Initialization and termination methods.
ACE_Svc_Handler (ACE_Thread_Manager * = 0,
ACE_Message_Queue<ACE_SYNCH_2> * = 0,
- ACE_Reactor * = ACE_Service_Config::reactor ());
+ ACE_Reactor * = ACE_Reactor::instance ());
virtual ~ACE_Svc_Handler (void);
@@ -135,7 +135,7 @@ private:
// Keeps track of whether we are in the process of closing (required
// to avoid circular calls to <handle_close>).
-#if defined (ACE_MT_SAFE) && !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) && !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
static ACE_Thread_Mutex ace_svc_handler_lock_;
// Lock the creation of the Singleton.
#endif /* defined (ACE_MT_SAFE) && !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) */
diff --git a/ace/Synch.cpp b/ace/Synch.cpp
index fdf60c6e40a..5a89668a0e6 100644
--- a/ace/Synch.cpp
+++ b/ace/Synch.cpp
@@ -6,6 +6,7 @@
#define ACE_BUILD_DLL
#include "ace/Thread.h"
+#include "ace/Synch_T.h"
#include "ace/Synch.h"
#if !defined (__ACE_INLINE__)
diff --git a/ace/System_Time.h b/ace/System_Time.h
index 948ec2d2a54..152e56b682a 100644
--- a/ace/System_Time.h
+++ b/ace/System_Time.h
@@ -19,7 +19,11 @@
#define ACE_SYSTEM_TIME_H
#include "ace/OS.h"
-#include "ace/Malloc.h"
+#include "ace/Memory_Pool.h"
+#include "ace/Malloc_T.h"
+
+// fwd decl.
+class ACE_MMAP_MEMORY_POOL;
class ACE_Export ACE_Date_Time
// TITLE
diff --git a/ace/Task.cpp b/ace/Task.cpp
index 66fccadbdc6..d0995abe77b 100644
--- a/ace/Task.cpp
+++ b/ace/Task.cpp
@@ -17,7 +17,7 @@
#endif /* ACE_HAS_THREADS && ACE_HAS_THREAD_SPECIFIC_STORAGE */
#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
// Lock the creation of the Singleton.
ACE_Thread_Mutex ACE_Task_Exit::ace_task_lock_;
#endif /* defined (ACE_MT_SAFE) */
@@ -171,7 +171,7 @@ ACE_Task_Base::activate (long flags,
{
ACE_TRACE ("ACE_Task_Base::activate");
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1);
// If the task passed in is zero, we will use <this>
@@ -187,7 +187,7 @@ ACE_Task_Base::activate (long flags,
// active object and the caller didn't supply us with a
// Thread_Manager.
if (this->thr_mgr_ == 0)
- this->thr_mgr_ = ACE_Service_Config::thr_mgr ();
+ this->thr_mgr_ = ACE_Thread_Manager::instance ();
this->grp_id_ = this->thr_mgr_->spawn_n (n_threads,
ACE_THR_FUNC (&ACE_Task_Base::svc_run),
diff --git a/ace/Task.h b/ace/Task.h
index b5ee372277b..2b800aa934f 100644
--- a/ace/Task.h
+++ b/ace/Task.h
@@ -176,7 +176,7 @@ public:
int grp_id_;
// This maintains the group id of the Task.
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
ACE_Thread_Mutex lock_;
// Protect the state of a Task during concurrent operations, but
// only if we're configured as MT safe...
@@ -229,7 +229,7 @@ private:
// This is used to make sure that an ACE_Task registers and
// deregisters with the ACE_Thread_Manager correctly.
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
static ACE_Thread_Mutex ace_task_lock_;
// Lock the creation of the Singleton.
#endif /* defined (ACE_MT_SAFE) */
diff --git a/ace/Task_T.cpp b/ace/Task_T.cpp
index 489ec46371b..a891ba3a6d4 100644
--- a/ace/Task_T.cpp
+++ b/ace/Task_T.cpp
@@ -26,7 +26,7 @@ ACE_Task<ACE_SYNCH_2>::dump (void) const
ACE_DEBUG ((LM_DEBUG, "\nnext_ = %x", this->next_));
ACE_DEBUG ((LM_DEBUG, "\ngrp_id_ = %d", this->grp_id_));
ACE_DEBUG ((LM_DEBUG, "\nthr_count_ = %d", this->thr_count_));
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
this->lock_.dump ();
#endif /* ACE_MT_SAFE */
diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp
index 1895bdf4fe2..a8f9dd2e8b2 100644
--- a/ace/Thread_Manager.cpp
+++ b/ace/Thread_Manager.cpp
@@ -2,6 +2,7 @@
// $Id$
#define ACE_BUILD_DLL
+#include "ace/Synch_T.h"
#include "ace/Thread_Manager.h"
#if !defined (__ACE_INLINE__)
@@ -11,6 +12,18 @@
ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Control)
ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Manager)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+// Lock the creation of the Singletons.
+static ACE_Thread_Mutex ace_thread_manager_lock_;
+#endif /* ACE_MT_SAFE */
+
+// Process-wide Thread Manager.
+ACE_Thread_Manager *ACE_Thread_Manager::thr_mgr_ = 0;
+
+// Controls whether the Thread_Manager is deleted when we shut down
+// (we can only delete it safely if we created it!)
+int ACE_Thread_Manager::delete_thr_mgr_ = 0;
+
void
ACE_Thread_Manager::dump (void) const
{
@@ -153,6 +166,56 @@ ACE_Thread_Manager::ACE_Thread_Manager (size_t size)
ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Thread_Manager"));
}
+ACE_Thread_Manager *
+ACE_Thread_Manager::instance (void)
+{
+ ACE_TRACE ("ACE_Thread_Manager::instance");
+
+ if (ACE_Thread_Manager::thr_mgr_ == 0)
+ {
+ // Perform Double-Checked Locking Optimization.
+ ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_thread_manager_lock_, 0));
+
+ if (ACE_Thread_Manager::thr_mgr_ == 0)
+ {
+ ACE_NEW_RETURN (ACE_Thread_Manager::thr_mgr_, ACE_Thread_Manager, 0);
+ ACE_Thread_Manager::delete_thr_mgr_ = 1;
+ }
+ }
+
+ return ACE_Thread_Manager::thr_mgr_;
+}
+
+ACE_Thread_Manager *
+ACE_Thread_Manager::instance (ACE_Thread_Manager *tm)
+{
+ ACE_TRACE ("ACE_Thread_Manager::instance");
+
+ ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_thread_manager_lock_, 0));
+
+ ACE_Thread_Manager *t = ACE_Thread_Manager::thr_mgr_;
+ // We can't safely delete it since we don't know who created it!
+ ACE_Thread_Manager::delete_thr_mgr_ = 0;
+
+ ACE_Thread_Manager::thr_mgr_ = tm;
+ return t;
+}
+
+void
+ACE_Thread_Manager::close_singleton (void)
+{
+ ACE_TRACE ("ACE_Thread_Manager::close_singleton");
+
+ ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, ace_thread_manager_lock_));
+
+ if (ACE_Thread_Manager::delete_thr_mgr_)
+ {
+ delete ACE_Thread_Manager::thr_mgr_;
+ ACE_Thread_Manager::thr_mgr_ = 0;
+ ACE_Thread_Manager::delete_thr_mgr_ = 0;
+ }
+}
+
// Close up and release all resources.
int
diff --git a/ace/Thread_Manager.h b/ace/Thread_Manager.h
index a21eadd7a43..80792193461 100644
--- a/ace/Thread_Manager.h
+++ b/ace/Thread_Manager.h
@@ -89,6 +89,16 @@ public:
ACE_Thread_Manager (size_t size = ACE_Thread_Manager::DEFAULT_SIZE);
virtual ~ACE_Thread_Manager (void);
+ static ACE_Thread_Manager *instance (void);
+ // Get pointer to a process-wide <ACE_Thread_Manager>.
+
+ static ACE_Thread_Manager *instance (ACE_Thread_Manager *);
+ // Set pointer to a process-wide <ACE_Thread_Manager> and return
+ // existing pointer.
+
+ static void close_singleton (void);
+ // Delete the dynamically allocated Singleton
+
int open (size_t size = DEFAULT_SIZE);
// Initialize the manager with room for SIZE threads.
@@ -369,6 +379,12 @@ protected:
ACE_Thread_Mutex lock_;
ACE_Condition_Thread_Mutex zero_cond_;
#endif /* ACE_HAS_THREADS */
+private:
+ static ACE_Thread_Manager *thr_mgr_;
+ // Pointer to a process-wide <ACE_Thread_Manager>.
+
+ static int delete_thr_mgr_;
+ // Must delete the <thr_mgr_> if non-0.
};
diff --git a/ace/Token.cpp b/ace/Token.cpp
index 4b8320cf2e2..6ab6495501f 100644
--- a/ace/Token.cpp
+++ b/ace/Token.cpp
@@ -8,6 +8,7 @@
#if defined (ACE_HAS_THREADS)
#if !defined (__ACE_INLINE__)
+#include "ace/Synch_T.h"
#include "ace/Token.i"
#endif /* __ACE_INLINE__ */
diff --git a/ace/Token.h b/ace/Token.h
index 1fd995fb5bc..26d76735f8c 100644
--- a/ace/Token.h
+++ b/ace/Token.h
@@ -165,6 +165,7 @@ private:
};
#if defined (__ACE_INLINE__)
+#include "ace/Synch_T.h"
#include "ace/Token.i"
#endif /* __ACE_INLINE__ */
#else
diff --git a/ace/UPIPE_Stream.h b/ace/UPIPE_Stream.h
index b71f83c482e..d3891067b1e 100644
--- a/ace/UPIPE_Stream.h
+++ b/ace/UPIPE_Stream.h
@@ -115,7 +115,7 @@ private:
// Keep track of whether the sender and receiver have both shut
// down.
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
ACE_Thread_Mutex lock_;
// Ensure that we are thread-safe.
#endif /* ACE_MT_SAFE */
diff --git a/ace/XtReactor.cpp b/ace/XtReactor.cpp
index 4a40fef52f3..cfc82d78c4f 100644
--- a/ace/XtReactor.cpp
+++ b/ace/XtReactor.cpp
@@ -39,7 +39,7 @@ ACE_XtReactor::ACE_XtReactor (XtAppContext context,
// we simply close and re-opened the notification handler in the
// constructor of the XtReactor.
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
this->notify_handler_.close ();
this->notify_handler_.open (this);
#endif /* ACE_MT_SAFE */
diff --git a/ace/ace.mak b/ace/ace.mak
index 655bc831b07..f49482eb235 100644
--- a/ace/ace.mak
+++ b/ace/ace.mak
@@ -20205,10 +20205,6 @@ SOURCE=.\Message_Block.cpp
DEP_CPP_MESSA=\
{$(INCLUDE)}"\.\ACE.h"\
{$(INCLUDE)}"\.\ACE.i"\
- {$(INCLUDE)}"\.\Addr.h"\
- {$(INCLUDE)}"\.\Addr.i"\
- {$(INCLUDE)}"\.\Asynch_IO.h"\
- {$(INCLUDE)}"\.\Asynch_IO.i"\
{$(INCLUDE)}"\.\Auto_Ptr.cpp"\
{$(INCLUDE)}"\.\Auto_Ptr.h"\
{$(INCLUDE)}"\.\Auto_Ptr.i"\
@@ -20223,19 +20219,6 @@ DEP_CPP_MESSA=\
{$(INCLUDE)}"\.\Free_List.cpp"\
{$(INCLUDE)}"\.\Free_List.h"\
{$(INCLUDE)}"\.\Free_List.i"\
- {$(INCLUDE)}"\.\Handle_Set.h"\
- {$(INCLUDE)}"\.\Handle_Set.i"\
- {$(INCLUDE)}"\.\Hash_Map_Manager.cpp"\
- {$(INCLUDE)}"\.\Hash_Map_Manager.h"\
- {$(INCLUDE)}"\.\High_Res_Timer.h"\
- {$(INCLUDE)}"\.\High_Res_Timer.i"\
- {$(INCLUDE)}"\.\INET_Addr.h"\
- {$(INCLUDE)}"\.\INET_Addr.i"\
- {$(INCLUDE)}"\.\IO_Cntl_Msg.h"\
- {$(INCLUDE)}"\.\IPC_SAP.h"\
- {$(INCLUDE)}"\.\IPC_SAP.i"\
- {$(INCLUDE)}"\.\Local_Tokens.h"\
- {$(INCLUDE)}"\.\Local_Tokens.i"\
{$(INCLUDE)}"\.\Log_Msg.h"\
{$(INCLUDE)}"\.\Log_Priority.h"\
{$(INCLUDE)}"\.\Log_Record.h"\
@@ -20245,79 +20228,30 @@ DEP_CPP_MESSA=\
{$(INCLUDE)}"\.\Malloc_T.cpp"\
{$(INCLUDE)}"\.\Malloc_T.h"\
{$(INCLUDE)}"\.\Malloc_T.i"\
- {$(INCLUDE)}"\.\Map_Manager.cpp"\
- {$(INCLUDE)}"\.\Map_Manager.h"\
- {$(INCLUDE)}"\.\Map_Manager.i"\
{$(INCLUDE)}"\.\Mem_Map.h"\
{$(INCLUDE)}"\.\Mem_Map.i"\
{$(INCLUDE)}"\.\Memory_Pool.h"\
{$(INCLUDE)}"\.\Memory_Pool.i"\
{$(INCLUDE)}"\.\Message_Block.h"\
{$(INCLUDE)}"\.\Message_Block.i"\
- {$(INCLUDE)}"\.\Message_Queue.cpp"\
- {$(INCLUDE)}"\.\Message_Queue.h"\
- {$(INCLUDE)}"\.\Message_Queue.i"\
{$(INCLUDE)}"\.\OS.h"\
{$(INCLUDE)}"\.\OS.i"\
- {$(INCLUDE)}"\.\Pipe.h"\
- {$(INCLUDE)}"\.\Pipe.i"\
- {$(INCLUDE)}"\.\Proactor.h"\
- {$(INCLUDE)}"\.\Proactor.i"\
- {$(INCLUDE)}"\.\Reactor.h"\
- {$(INCLUDE)}"\.\Reactor.i"\
- {$(INCLUDE)}"\.\ReactorEx.h"\
- {$(INCLUDE)}"\.\ReactorEx.i"\
- {$(INCLUDE)}"\.\Service_Config.h"\
- {$(INCLUDE)}"\.\Service_Config.i"\
- {$(INCLUDE)}"\.\Service_Object.h"\
- {$(INCLUDE)}"\.\Service_Object.i"\
- {$(INCLUDE)}"\.\Shared_Object.h"\
- {$(INCLUDE)}"\.\Shared_Object.i"\
{$(INCLUDE)}"\.\Signal.h"\
{$(INCLUDE)}"\.\Signal.i"\
- {$(INCLUDE)}"\.\SOCK.h"\
- {$(INCLUDE)}"\.\SOCK.i"\
- {$(INCLUDE)}"\.\SOCK_IO.h"\
- {$(INCLUDE)}"\.\SOCK_IO.i"\
- {$(INCLUDE)}"\.\SOCK_Stream.h"\
- {$(INCLUDE)}"\.\SOCK_Stream.i"\
{$(INCLUDE)}"\.\SString.h"\
{$(INCLUDE)}"\.\SString.i"\
{$(INCLUDE)}"\.\stdcpp.h"\
- {$(INCLUDE)}"\.\Strategies.h"\
- {$(INCLUDE)}"\.\Strategies_T.cpp"\
- {$(INCLUDE)}"\.\Strategies_T.h"\
{$(INCLUDE)}"\.\SV_Semaphore_Complex.h"\
{$(INCLUDE)}"\.\SV_Semaphore_Complex.i"\
{$(INCLUDE)}"\.\SV_Semaphore_Simple.h"\
{$(INCLUDE)}"\.\SV_Semaphore_Simple.i"\
- {$(INCLUDE)}"\.\Svc_Conf_Tokens.h"\
{$(INCLUDE)}"\.\Synch.h"\
{$(INCLUDE)}"\.\Synch.i"\
- {$(INCLUDE)}"\.\Synch_Options.h"\
{$(INCLUDE)}"\.\Synch_T.cpp"\
{$(INCLUDE)}"\.\Synch_T.h"\
{$(INCLUDE)}"\.\Synch_T.i"\
{$(INCLUDE)}"\.\Thread.h"\
{$(INCLUDE)}"\.\Thread.i"\
- {$(INCLUDE)}"\.\Thread_Manager.h"\
- {$(INCLUDE)}"\.\Thread_Manager.i"\
- {$(INCLUDE)}"\.\Time_Value.h"\
- {$(INCLUDE)}"\.\Timer_Heap.h"\
- {$(INCLUDE)}"\.\Timer_Heap_T.cpp"\
- {$(INCLUDE)}"\.\Timer_Heap_T.h"\
- {$(INCLUDE)}"\.\Timer_List.h"\
- {$(INCLUDE)}"\.\Timer_List_T.cpp"\
- {$(INCLUDE)}"\.\Timer_List_T.h"\
- {$(INCLUDE)}"\.\Timer_Queue.h"\
- {$(INCLUDE)}"\.\Timer_Queue_T.cpp"\
- {$(INCLUDE)}"\.\Timer_Queue_T.h"\
- {$(INCLUDE)}"\.\Timer_Queue_T.i"\
- {$(INCLUDE)}"\.\Timer_Wheel.h"\
- {$(INCLUDE)}"\.\Timer_Wheel_T.cpp"\
- {$(INCLUDE)}"\.\Timer_Wheel_T.h"\
- {$(INCLUDE)}"\.\Token.h"\
- {$(INCLUDE)}"\.\Token.i"\
{$(INCLUDE)}"\.\Trace.h"\
{$(INCLUDE)}"\.\ws2tcpip.h"\
diff --git a/ace/ace.mdp b/ace/ace.mdp
index c7d5ddb5b06..b230be293f6 100644
--- a/ace/ace.mdp
+++ b/ace/ace.mdp
Binary files differ
diff --git a/ace/config-aix-4.1.x.h b/ace/config-aix-4.1.x.h
index eac4691d2b3..5cd35f136c6 100644
--- a/ace/config-aix-4.1.x.h
+++ b/ace/config-aix-4.1.x.h
@@ -47,7 +47,9 @@
#define ACE_HAS_POSIX_TIME
#define ACE_HAS_SVR4_TIME
#define ACE_HAS_THREADS
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
#define ACE_HAS_UTIME
#define ACE_HAS_SELECT_H
#define ACE_NEEDS_DEV_IO_CONVERSION
diff --git a/ace/config-aix-4.2.x.h b/ace/config-aix-4.2.x.h
index fd11cd526cf..2a7dc792286 100644
--- a/ace/config-aix-4.2.x.h
+++ b/ace/config-aix-4.2.x.h
@@ -46,7 +46,9 @@
#define ACE_HAS_POSIX_TIME
#define ACE_HAS_SVR4_TIME
#define ACE_HAS_THREADS
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
#define ACE_HAS_UTIME
#define ACE_HAS_SELECT_H
#define ACE_NEEDS_DEV_IO_CONVERSION
diff --git a/ace/config-chorus.h b/ace/config-chorus.h
index 20ab1bc3d5d..c9a4319f1b9 100644
--- a/ace/config-chorus.h
+++ b/ace/config-chorus.h
@@ -90,7 +90,9 @@
#define ACE_HAS_POSIX_SEM
#define ACE_LACKS_NAMED_POSIX_SEM
#define ACE_HAS_THREAD_SPECIFIC_STORAGE
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
// And they're even POSIX pthreads
#define ACE_HAS_PTHREADS
#define ACE_LACKS_PTHREAD_CLEANUP
diff --git a/ace/config-dgux-4.11-epc.h b/ace/config-dgux-4.11-epc.h
index 356c057421b..7bbe82a35c6 100644
--- a/ace/config-dgux-4.11-epc.h
+++ b/ace/config-dgux-4.11-epc.h
@@ -125,7 +125,9 @@
/* Turn off the following four defines if you want to disable threading. */
// Compile using multi-thread libraries.
-// #define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 0
+#endif
// Platform supports threads.
// #define ACE_HAS_THREADS
diff --git a/ace/config-freebsd-pthread.h b/ace/config-freebsd-pthread.h
index ac1d5656653..bcf5f8d0673 100644
--- a/ace/config-freebsd-pthread.h
+++ b/ace/config-freebsd-pthread.h
@@ -134,7 +134,9 @@ enum schedparam_policy {
// Yes, we do have threads.
#define ACE_HAS_THREADS
// And they're even POSIX pthreads
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
#define ACE_HAS_PTHREADS
#define ACE_LACKS_SETSCHED
#define ACE_LACKS_THREAD_PROCESS_SCOPING
diff --git a/ace/config-hpux-10.x-aCC.h b/ace/config-hpux-10.x-aCC.h
index 7e7e7f171c5..76de568ef68 100644
--- a/ace/config-hpux-10.x-aCC.h
+++ b/ace/config-hpux-10.x-aCC.h
@@ -67,6 +67,9 @@
// #define ACE_HAS_THREADS
// #define ACE_HAS_PTHREADS
// #define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 0
+#endif
#define ACE_HAS_SIGINFO_T
#define ACE_HAS_UCONTEXT_T
#define ACE_LACKS_PTHREAD_THR_SIGSETMASK
diff --git a/ace/config-hpux-10.x-decthreads.h b/ace/config-hpux-10.x-decthreads.h
index b28e0b40f58..387e3190448 100644
--- a/ace/config-hpux-10.x-decthreads.h
+++ b/ace/config-hpux-10.x-decthreads.h
@@ -90,7 +90,9 @@
#define ACE_HAS_TID_T /* added by shankar */
#define ACE_LACKS_SETSCHED /* added by shankar */
#define ACE_LACKS_RWLOCK_T
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
#define ACE_HAS_SIGINFO_T
#define ACE_LACKS_PTHREAD_THR_SIGSETMASK
#define ACE_HAS_SETKIND_NP
diff --git a/ace/config-hpux-10.x-nothread.h b/ace/config-hpux-10.x-nothread.h
index dc1098997fb..72d751932c0 100644
--- a/ace/config-hpux-10.x-nothread.h
+++ b/ace/config-hpux-10.x-nothread.h
@@ -84,7 +84,9 @@
// #define ACE_HAS_THREADS
// #define ACE_HAS_PTHREADS
// #define ACE_LACKS_RWLOCK_T
-// #define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 0
+#endif
// #define ACE_LACKS_PTHREAD_THR_SIGSETMASK
// #define ACE_HAS_SETKIND_NP
// #define ACE_LACKS_CONDATTR_PSHARED
diff --git a/ace/config-hpux-10.x.h b/ace/config-hpux-10.x.h
index 8d6f4830bca..9cb0f51397c 100644
--- a/ace/config-hpux-10.x.h
+++ b/ace/config-hpux-10.x.h
@@ -145,7 +145,9 @@ extern int h_errno; /* This isn't declared in a header file on HP-UX */
////////////////////////////////////////////////////////////////////////
#ifdef _ACE_HPUX_USE_DCETHREADS
-# define ACE_MT_SAFE
+# if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+# endif
# define ACE_HAS_THREADS
# define ACE_HAS_DCETHREADS
# define ACE_HAS_DCE_DRAFT4_THREADS
diff --git a/ace/config-hpux-9.x-orbix.h b/ace/config-hpux-9.x-orbix.h
index 4a3395e01d3..ff421831cf8 100644
--- a/ace/config-hpux-9.x-orbix.h
+++ b/ace/config-hpux-9.x-orbix.h
@@ -22,7 +22,7 @@
#define ACE_LACKS_CONST_TIMESPEC_PTR
// ************* HERE IS THE ORBIX STUFF - Dave 4/2/96
-#define ACE_HAS_ORBIX
+#define ACE_HAS_ORBIX 1
#define ACE_LACKS_SYSCALL
#define ACE_LACKS_STRRECVFD
diff --git a/ace/config-irix6.2-sgic++.h b/ace/config-irix6.2-sgic++.h
index a82bddb1c63..ac718dae5d0 100644
--- a/ace/config-irix6.2-sgic++.h
+++ b/ace/config-irix6.2-sgic++.h
@@ -52,7 +52,9 @@
#define ACE_HAS_THREAD_SPECIFIC_STORAGE
// Compile using multi-thread libraries
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
// Platform supports the tid_t type (e.g., AIX and Irix 6.2)
#define ACE_HAS_TID_T
diff --git a/ace/config-irix6.4-sgic++.h b/ace/config-irix6.4-sgic++.h
index ceae47fd4d7..68c100e7a67 100644
--- a/ace/config-irix6.4-sgic++.h
+++ b/ace/config-irix6.4-sgic++.h
@@ -52,7 +52,9 @@
#define ACE_HAS_THREAD_SPECIFIC_STORAGE
// Compile using multi-thread libraries
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
// Platform supports the tid_t type (e.g., AIX and Irix 6.2)
#define ACE_HAS_TID_T
diff --git a/ace/config-linux-lxpthreads.h b/ace/config-linux-lxpthreads.h
index 4c9dce65714..cc938425bbe 100644
--- a/ace/config-linux-lxpthreads.h
+++ b/ace/config-linux-lxpthreads.h
@@ -133,7 +133,9 @@
#define ACE_HAS_PTHREAD_SIGMASK // JCEJ 12/19/96
-#define ACE_MT_SAFE // JCEJ 12/22/96 #1
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1 // JCEJ 12/22/96 #1
+#endif
#define ACE_HAS_THREAD_SPECIFIC_STORAGE // jcej 12/22/96 #2
#define PTHREAD_MIN_PRIORITY 0 // JCEJ 12/22/96 #3
#if defined(ACE_HAS_PTHREAD_SIGMASK)
diff --git a/ace/config-linux-pthread.h b/ace/config-linux-pthread.h
index 866fbaaeffc..b952623efe0 100644
--- a/ace/config-linux-pthread.h
+++ b/ace/config-linux-pthread.h
@@ -107,7 +107,9 @@
#define ACE_HAS_THREADS
#define ACE_HAS_THREAD_SPECIFIC_STORAGE
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
// And they're even POSIX pthreads (MIT implementation)
#define ACE_HAS_PTHREADS
#define ACE_LACKS_RWLOCK_T
diff --git a/ace/config-m88k.h b/ace/config-m88k.h
index 6c222d55cb7..3a53f1e345c 100644
--- a/ace/config-m88k.h
+++ b/ace/config-m88k.h
@@ -176,7 +176,9 @@ struct ip_mreq
/* Turn off the following five defines if you want to disable threading. */
// Compile using multi-thread libraries.
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
#define ACE_HAS_PTHREADS
#define ACE_LACKS_RWLOCK_T
diff --git a/ace/config-mvs.h b/ace/config-mvs.h
index 486e2b2158d..ce23df74689 100644
--- a/ace/config-mvs.h
+++ b/ace/config-mvs.h
@@ -83,7 +83,9 @@
#define ACE_LACKS_TCP_H
#define ACE_LACKS_THREAD_PROCESS_SCOPING
#define ACE_LACKS_THREAD_STACK_ADDR
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
#define ACE_NEEDS_DEV_IO_CONVERSION
#define ACE_NEEDS_SYSTIME_H
#define ACE_TEMPLATES_REQUIRE_SOURCE
diff --git a/ace/config-osf1-3.2.h b/ace/config-osf1-3.2.h
index 4009d1322bf..402df10a4fa 100644
--- a/ace/config-osf1-3.2.h
+++ b/ace/config-osf1-3.2.h
@@ -155,7 +155,9 @@
#define ACE_HAS_TLI
// Compile using multi-thread libraries.
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
#define ACE_NEEDS_DEV_IO_CONVERSION
diff --git a/ace/config-osf1-4.0-g++.h b/ace/config-osf1-4.0-g++.h
index 7a02475b7c1..0555615df10 100644
--- a/ace/config-osf1-4.0-g++.h
+++ b/ace/config-osf1-4.0-g++.h
@@ -192,7 +192,9 @@
#define ACE_LACKS_THREAD_PROCESS_SCOPING
// Compile using multi-thread libraries.
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
// Turns off the tracing feature.
#if !defined (ACE_NTRACE)
diff --git a/ace/config-osf1-4.0.h b/ace/config-osf1-4.0.h
index 6ed7a37a7ff..182602f300c 100644
--- a/ace/config-osf1-4.0.h
+++ b/ace/config-osf1-4.0.h
@@ -174,7 +174,9 @@
#define ACE_LACKS_THREAD_PROCESS_SCOPING
// Compile using multi-thread libraries.
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
#define ACE_NEEDS_DEV_IO_CONVERSION
diff --git a/ace/config-sco-5.0.0-mit-pthread.h b/ace/config-sco-5.0.0-mit-pthread.h
index cf0ba6ba604..6449500665f 100644
--- a/ace/config-sco-5.0.0-mit-pthread.h
+++ b/ace/config-sco-5.0.0-mit-pthread.h
@@ -127,7 +127,9 @@
// Threads
#define ACE_HAS_THREADS
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
#define ACE_HAS_THREAD_SPECIFIC_STORAGE
#define ACE_HAS_PTHREADS
#define ACE_HAS_PTHREAD_T
diff --git a/ace/config-sunos4-sun4.x-orbix.h b/ace/config-sunos4-sun4.x-orbix.h
index f05290c68e9..f5584ee296a 100644
--- a/ace/config-sunos4-sun4.x-orbix.h
+++ b/ace/config-sunos4-sun4.x-orbix.h
@@ -28,7 +28,7 @@
#define ACE_HAS_GETRUSAGE
// Platform contains Orbix CORBA implementation.
-#define ACE_HAS_ORBIX
+#define ACE_HAS_ORBIX 1
// Compiler/platform supports strerror ().
// #define ACE_HAS_STRERROR
diff --git a/ace/config-sunos5.4-centerline-2.x.h b/ace/config-sunos5.4-centerline-2.x.h
index 0bf46dc40e0..30132ba7a88 100644
--- a/ace/config-sunos5.4-centerline-2.x.h
+++ b/ace/config-sunos5.4-centerline-2.x.h
@@ -123,7 +123,9 @@
/* Turn off the following four defines if you want to disable threading. */
// Compile using multi-thread libraries.
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
// Platform supports threads.
#define ACE_HAS_THREADS
diff --git a/ace/config-sunos5.4-g++.h b/ace/config-sunos5.4-g++.h
index da23743d5be..331c13a6089 100644
--- a/ace/config-sunos5.4-g++.h
+++ b/ace/config-sunos5.4-g++.h
@@ -144,8 +144,10 @@
/* Turn off the following four defines if you want to disable threading. */
// Compile using multi-thread libraries.
-#define _REENTRANT
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+ #define _REENTRANT
+#endif
// Platform supports Solaris threads.
#define ACE_HAS_STHREADS
diff --git a/ace/config-sunos5.4-sunc++-4.x-orbix.h b/ace/config-sunos5.4-sunc++-4.x-orbix.h
index 21f0884629c..4d8767b06b5 100644
--- a/ace/config-sunos5.4-sunc++-4.x-orbix.h
+++ b/ace/config-sunos5.4-sunc++-4.x-orbix.h
@@ -74,7 +74,7 @@
#define ACE_HAS_MT_SAFE_SOCKETS
// Platform contains the Orbix CORBA implementation.
-#define ACE_HAS_ORBIX
+#define ACE_HAS_ORBIX 1
// Platform contains the multi-threaded Orbix CORBA implementation.
// #define ACE_HAS_MT_ORBIX
@@ -140,7 +140,9 @@
/* Turn off the following four defines if you want to disable threading. */
// Compile using multi-thread libraries.
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
// Platform supports Solaris threads.
#define ACE_HAS_STHREADS
diff --git a/ace/config-sunos5.4-sunc++-4.x.h b/ace/config-sunos5.4-sunc++-4.x.h
index 84ca416abe2..bd9f0124e92 100644
--- a/ace/config-sunos5.4-sunc++-4.x.h
+++ b/ace/config-sunos5.4-sunc++-4.x.h
@@ -133,7 +133,9 @@
/* Turn off the following four defines if you want to disable threading. */
// Compile using multi-thread libraries.
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
// Platform supports Solaris threads.
#define ACE_HAS_STHREADS
diff --git a/ace/config-sunos5.5-g++.h b/ace/config-sunos5.5-g++.h
index c10c15b8cc6..8f399359a01 100644
--- a/ace/config-sunos5.5-g++.h
+++ b/ace/config-sunos5.5-g++.h
@@ -150,8 +150,10 @@
/* Turn off the following seven defines if you want to disable threading. */
// Compile using multi-thread libraries.
-#define _REENTRANT
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+ #define _REENTRANT
+#endif
// Platform supports threads.
#define ACE_HAS_THREADS
diff --git a/ace/config-sunos5.5-sunc++-4.x-orbix.h b/ace/config-sunos5.5-sunc++-4.x-orbix.h
index ac74f3fbe76..7db1d0a4679 100644
--- a/ace/config-sunos5.5-sunc++-4.x-orbix.h
+++ b/ace/config-sunos5.5-sunc++-4.x-orbix.h
@@ -11,7 +11,7 @@
#define ACE_CONFIG_ORBIX_H
// Platform contains the Orbix CORBA implementation.
-#define ACE_HAS_ORBIX
+#define ACE_HAS_ORBIX 1
// Platform contains the multi-threaded Orbix CORBA implementation.
//#define ACE_HAS_MT_ORBIX
diff --git a/ace/config-sunos5.5-sunc++-4.x.h b/ace/config-sunos5.5-sunc++-4.x.h
index a72c73e46c9..44440ae1e9a 100644
--- a/ace/config-sunos5.5-sunc++-4.x.h
+++ b/ace/config-sunos5.5-sunc++-4.x.h
@@ -155,7 +155,9 @@
/* Comment out the following eight defines if you want to disable threading. */
// Compile using multi-thread libraries.
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
// Platform supports threads.
#define ACE_HAS_THREADS
diff --git a/ace/config-sunx86-sunc++-4.x.h b/ace/config-sunx86-sunc++-4.x.h
index 39d056c860f..74517562e95 100644
--- a/ace/config-sunx86-sunc++-4.x.h
+++ b/ace/config-sunx86-sunc++-4.x.h
@@ -105,7 +105,9 @@
/* Turn off the following three defines if you want to disable threading. */
// Compile using multi-thread libraries.
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
// Platform supports Solaris threads.
#define ACE_HAS_STHREADS
diff --git a/ace/config-tandem.h b/ace/config-tandem.h
index 7f18a15d39f..8ae604562f1 100644
--- a/ace/config-tandem.h
+++ b/ace/config-tandem.h
@@ -174,7 +174,9 @@
/****** THREAD SPECIFIC **********/
/* If you want to remove threading then comment out the following four #defines .*/
-#define ACE_MT_SAFE //Compile using multi-thread libraries
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1 //Compile using multi-thread libraries
+#endif
#define ACE_HAS_THREADS //Platform supports threads
#define ACE_HAS_STHREADS //Platform supports Solaris threads
@@ -337,6 +339,9 @@
//ACE_HAS_OLD_MALLOC Compiler/platform uses old malloc()/
// free() prototypes (ugh)
+#if !defined (ACE_HAS_ORBIX)
+ #define ACE_HAS_ORBIX 0
+#endif
// ACE_HAS_ORBIX Platform has Orbix CORBA implementation
//? ACE_HAS_POSIX_SEM Platform supports POSIX real-time
//semaphores (e.g., VxWorks and Solaris)
diff --git a/ace/config-unixware-2.01-g++.h b/ace/config-unixware-2.01-g++.h
index 50403eba8f6..1076ee5c0de 100644
--- a/ace/config-unixware-2.01-g++.h
+++ b/ace/config-unixware-2.01-g++.h
@@ -65,7 +65,9 @@
#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES
#define ACE_LACKS_SYSCALL
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
#define ACE_PAGE_SIZE 4096
#define ACE_REDEFINES_XTI_FUNCTIONS
#define ACE_TEMPLATES_REQUIRE_SOURCE
diff --git a/ace/config-unixware-2.1.2-g++.h b/ace/config-unixware-2.1.2-g++.h
index 7b04e270c93..f643c780645 100644
--- a/ace/config-unixware-2.1.2-g++.h
+++ b/ace/config-unixware-2.1.2-g++.h
@@ -66,7 +66,9 @@
#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS
#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
#define ACE_PAGE_SIZE 4096
#define ACE_REDEFINES_XTI_FUNCTIONS
#define ACE_TEMPLATES_REQUIRE_SOURCE
diff --git a/ace/config-vxworks-ghs-1.8.h b/ace/config-vxworks-ghs-1.8.h
index 88ad9b1e137..9f158770fcf 100644
--- a/ace/config-vxworks-ghs-1.8.h
+++ b/ace/config-vxworks-ghs-1.8.h
@@ -61,7 +61,9 @@
#define ACE_LACKS_SYSV_SHMEM
#define ACE_LACKS_UCONTEXT_H
#define ACE_LACKS_UTSNAME_T
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
#define ACE_NEEDS_SYSTIME_H
// Defines the page size of the system.
diff --git a/ace/config-vxworks5.x-g++.h b/ace/config-vxworks5.x-g++.h
index fe90de4a425..550ee7e74d8 100644
--- a/ace/config-vxworks5.x-g++.h
+++ b/ace/config-vxworks5.x-g++.h
@@ -80,7 +80,9 @@
#define ACE_LACKS_SYS_NERR
#define ACE_LACKS_UCONTEXT_H
#define ACE_LACKS_UTSNAME_T
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
#define ACE_NEEDS_SYSTIME_H
#define ACE_TEMPLATES_REQUIRE_SOURCE
#define ACE_TEMPLATES_REQUIRE_SPECIALIZATION
diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h
index 973173e2168..29aee81dd0f 100644
--- a/ace/config-win32-common.h
+++ b/ace/config-win32-common.h
@@ -141,9 +141,13 @@
#endif
// MFC itself defines STRICT.
-#if defined ACE_HAS_MFC
+#if defined( ACE_HAS_MFC ) && (ACE_HAS_MFC != 0)
#if !defined(ACE_HAS_STRICT)
- #define ACE_HAS_STRICT
+ #define ACE_HAS_STRICT 1
+ #endif
+ #if (ACE_HAS_STRICT != 1)
+ #undef ACE_HAS_STRICT
+ #define ACE_HAS_STRICT 1
#endif
#endif
@@ -155,7 +159,7 @@
#define ACE_HAS_PENTIUM
#endif
-#if defined(ACE_MT_SAFE)
+#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
// Platform supports threads.
#define ACE_HAS_THREADS
@@ -172,14 +176,14 @@
#endif
// use DLLs instead of static libs
- #if !defined(_DLL)
- #define _DLL
- #endif
+// #if !defined(_DLL)
+// #define _DLL
+// #endif
#endif
// We are using STL's min and max (in algobase.h). Therefore the
// macros in window.h are extra
-#if !defined NOMINMAX
+#if !defined (NOMINMAX)
#define NOMINMAX
#endif /* NOMINMAX */
@@ -211,7 +215,7 @@
#endif
// We are build ACE and want to use MFC (multithreaded)
-#if defined(ACE_HAS_DLL) && defined(ACE_BUILD_DLL) && defined(ACE_HAS_MFC) && defined (_MT)
+#if (ACE_HAS_DLL != 0) && defined(ACE_BUILD_DLL) && defined(ACE_HAS_MFC) && (ACE_HAS_MFC != 0) && defined (_MT)
#if !defined (_AFXDLL)
// force multithreaded MFC DLL
#define _AFXDLL
@@ -235,7 +239,7 @@
// This is necessary since MFC users apparently can't #include
// <windows.h> directly.
#if defined (_AFXDLL) || defined (_WINDLL) || \
- ( defined(ACE_HAS_DLL) && defined(ACE_BUILD_DLL) && defined(ACE_HAS_MFC))
+ ( (ACE_HAS_DLL != 0) && defined(ACE_BUILD_DLL) && (ACE_HAS_MFC != 0))
#include /**/ <afxwin.h> /* He is doing MFC */
// Windows.h will be included via afxwin.h->afx.h->afx_ver_.h->afxv_w32.h
// #define _INC_WINDOWS // Prevent winsock.h from including windows.h
@@ -243,7 +247,7 @@
#if !defined (_INC_WINDOWS) /* Already include windows.h ? */
// Must define strict before including windows.h !
- #if defined (ACE_HAS_STRICT)
+ #if defined (ACE_HAS_STRICT) && (ACE_HAS_STRICT != 0)
#define STRICT 1
#endif /* ACE_HAS_STRICT */
@@ -267,11 +271,13 @@
#endif /* !defined (_INC_INWDOWS) */
// Always use WS2 when available
-#if (_WIN32_WINNT >= 0x0400)
- #define ACE_HAS_WINSOCK2
+#if (ACE_HAS_WINNT4 != 0)
+ #if !defined(ACE_HAS_WINSOCK2)
+ #define ACE_HAS_WINSOCK2 1
+ #endif
#endif
-#if defined (ACE_HAS_WINSOCK2)
+#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
#if !defined (_WINSOCK2API_)
#include /**/ <winsock2.h> /* will also include windows.h, if not present */
@@ -300,7 +306,7 @@
#pragma warning(default: 4201) /* winnt.h uses nameless structs */
#endif /* _MSC_VER */
-#if(_WIN32_WINNT >= 0x0400)
+#if (_WIN32_WINNT >= 0x0400)
#define ACE_HAS_WIN32_TRYLOCK
#define ACE_HAS_SIGNAL_OBJECT_AND_WAIT
diff --git a/ace/config-win32.h b/ace/config-win32.h
index 13246be5d85..969a1c54bee 100644
--- a/ace/config-win32.h
+++ b/ace/config-win32.h
@@ -15,7 +15,13 @@
// Setting applies to : building ACE
// Runtime restrictions: System must be Windows NT => 4.0
// Additonal notes: Defining _WIN32_WINNT as 0x0400 implies ACE_HAS_WINSOCK2.
-#define _WIN32_WINNT 0x0400
+#if !defined (ACE_HAS_WINNT4)
+ #define ACE_HAS_WINNT4 1 // assuming Win NT 4.0 or greater
+
+ #if !defined (_WIN32_WINNT)
+ #define _WIN32_WINNT 0x0400
+ #endif
+#endif
// Uncomment this, if you want ACE to use CWinThread. This should
// be defined, if your application uses MFC.
@@ -24,26 +30,34 @@
// Additonal notes : If both ACE_HAS_MFC and ACE_MT_SAFE are
// defined, the MFC DLL (not the static lib)
// will be used from ACE.
-// #define ACE_HAS_MFC
+#if !defined (ACE_HAS_MFC)
+ #define ACE_HAS_MFC 0
+#endif
// Uncomment this out if you want to use STRICT type checking.
// It is disabled by default because it will break existing application code.
// Setting applies to : building ACE, linking with ACE
// Runtime restrictions: -
// Additonal notes : ACE_HAS_MFC implies ACE_HAS_STRICT
-// #define ACE_HAS_STRICT
+#if !defined (ACE_HAS_STRICT)
+ #define ACE_HAS_STRICT 0
+#endif
// Turn off the following define if you want to disable threading.
// Compile using multi-thread libraries.
// Setting applies to : building ACE, linking with ACE
// Runtime restrictions: multithreaded runtime DLL must be installed
-#define ACE_MT_SAFE
+#if !defined (ACE_MT_SAFE)
+ #define ACE_MT_SAFE 1
+#endif
// Build as as a DLL. Zap this line if you want to build a static
// lib.
// Setting applies to : building ACE, linking with ACE
// Runtime restrictions: ACE DLL must be installed :-)
-#define ACE_HAS_DLL
+#if !defined (ACE_HAS_DLL)
+ #define ACE_HAS_DLL 1
+#endif
// Build ACE services as DLLs. If you write a library and want it to
// use ACE_Svc_Export, this will cause those macros to build dlls. If
@@ -51,18 +65,27 @@
// line. As far as I know, the only reason to have a library be an
// ACE "service" is to leverage the ACE_Svc_Export macros. It's just
// as easy to define your own export macros.
-#define ACE_HAS_SVC_DLL
+#if !defined (ACE_HAS_SVC_DLL)
+ #define ACE_HAS_SVC_DLL 1
+#endif
// Define the following macro if you're compiling with WinSock 2.0.
// Setting applies to : building ACE
// Runtime restrictions: winsock2 must be installed.
-// #define ACE_HAS_WINSOCK2
+#if !defined (ACE_HAS_WINSOCK2)
+ #define ACE_HAS_WINSOCK2 0
+#endif
// Uncomment these if you want to integrate ACE and Orbix in Win32.
// Setting applies to : building ACE, linking with ACE
// Runtime restrictions: system must have Orbix DLLs
-// #define ACE_HAS_ORBIX
-// #define ACE_HAS_MT_ORBIX
+#if !defined (ACE_HAS_ORBIX)
+ #define ACE_HAS_ORBIX 0
+#endif
+
+#if !defined (ACE_HAS_MT_ORBIX)
+ #define ACE_HAS_MT_ORBIX 0
+#endif
// ----------------------- platform specific defines --------------------