summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-26 18:09:22 +0000
committernobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-26 18:09:22 +0000
commitb5450d6cec4417351c6b5fac84dcc8f4403f5ee6 (patch)
tree314874d80f60de7127db1bb6f214ad8c1e61d514
parent65c6b41c60caa972f182a794d2b421961fd16c01 (diff)
downloadATCD-b5450d6cec4417351c6b5fac84dcc8f4403f5ee6.tar.gz
This commit was manufactured by cvs2svn to create branch
'VxWorks_shlib'.
-rw-r--r--ace/Log_Msg_Manager.cpp51
-rw-r--r--ace/Log_Msg_Manager.h70
-rw-r--r--ace/Log_Msg_s.cpp63
-rw-r--r--ace/OS_s.cpp31
-rw-r--r--ace/Object_Manager_s.cpp13
5 files changed, 228 insertions, 0 deletions
diff --git a/ace/Log_Msg_Manager.cpp b/ace/Log_Msg_Manager.cpp
new file mode 100644
index 00000000000..40e136a2e7c
--- /dev/null
+++ b/ace/Log_Msg_Manager.cpp
@@ -0,0 +1,51 @@
+// $Id$
+
+#define ACE_BUILD_DLL
+
+#include "ace/Log_Msg_Manager.h"
+
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+
+#include "ace/Synch.h"
+
+ACE_Recursive_Thread_Mutex *
+ACE_Log_Msg_Manager::get_lock (void)
+{
+ // This function is called by the first thread to create an ACE_Log_Msg
+ // instance. It makes the call while holding a mutex, so we don't have
+ // to grab another one here.
+
+ if (ACE_Log_Msg_Manager::lock_ == 0)
+ {
+ ACE_NO_HEAP_CHECK;
+
+ ACE_NEW_RETURN_I (ACE_Log_Msg_Manager::lock_,
+ ACE_Recursive_Thread_Mutex,
+ 0);
+
+ // Allocate the ACE_Log_Msg IPC instance.
+ ACE_NEW_RETURN (message_queue_, ACE_LOG_MSG_IPC_STREAM, 0);
+ }
+
+ return ACE_Log_Msg_Manager::lock_;
+}
+
+void
+ACE_Log_Msg_Manager::close (void)
+{
+#if defined (ACE_HAS_STHREADS) && !defined (ACE_HAS_TSS_EMULATION) && \
+ !defined (ACE_HAS_EXCEPTIONS)
+ // Delete the (main thread's) Log_Msg instance. I think that this
+ // is only necessary if exception handling is not enabled.
+ // Without exception handling, main thread TSS destructors don't
+ // seem to be called. It's not really necessary anyways, because
+ // this one leak is harmless on Solaris.
+ delete ACE_Log_Msg::instance ();
+#endif /* ACE_HAS_STHREADS && ! TSS_EMULATION && ! ACE_HAS_EXCEPTIONS */
+
+ // Ugly, ugly, but don't know a better way.
+ delete ACE_Log_Msg_Manager::lock_;
+ ACE_Log_Msg_Manager::lock_ = 0;
+}
+
+#endif /* ACE_MT_SAFE */
diff --git a/ace/Log_Msg_Manager.h b/ace/Log_Msg_Manager.h
new file mode 100644
index 00000000000..94fcb19210a
--- /dev/null
+++ b/ace/Log_Msg_Manager.h
@@ -0,0 +1,70 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// ace
+//
+// = FILENAME
+// Log_Msg_Manager.h
+//
+// = AUTHOR
+// David L. Levine
+//
+// ============================================================================
+
+#ifndef ACE_LOG_MSG_MANAGER_H
+#define ACE_LOG_MSG_MANAGER_H
+
+#include "ace/inc_user_config.h"
+
+// IPC conduit between sender and client daemon. This should be
+// included in the <ACE_Log_Msg> class, but due to "order of include"
+// problems it can't be...
+#if defined (ACE_HAS_STREAM_PIPES)
+# include "ace/SPIPE_Connector.h"
+typedef ACE_SPIPE_Stream ACE_LOG_MSG_IPC_STREAM;
+typedef ACE_SPIPE_Connector ACE_LOG_MSG_IPC_CONNECTOR;
+typedef ACE_SPIPE_Addr ACE_LOG_MSG_IPC_ADDR;
+#else
+# include "ace/SOCK_Connector.h"
+typedef ACE_SOCK_Stream ACE_LOG_MSG_IPC_STREAM;
+typedef ACE_SOCK_Connector ACE_LOG_MSG_IPC_CONNECTOR;
+typedef ACE_INET_Addr ACE_LOG_MSG_IPC_ADDR;
+#endif /* ACE_HAS_STREAM_PIPES */
+
+class ACE_Recursive_Thread_Mutex;
+
+class ACE_Log_Msg_Manager
+ // = TITLE
+ // Synchronize output operations.
+ //
+ // = DESCRIPTION
+ // Provides global point of contact for all ACE_Log_Msg instances
+ // in a process.
+ //
+ // For internal use by ACE, only!
+{
+public:
+ static ACE_LOG_MSG_IPC_STREAM *message_queue_;
+
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+ static ACE_Recursive_Thread_Mutex *get_lock (void);
+
+ static void close (void);
+
+private:
+ static ACE_Recursive_Thread_Mutex *lock_;
+#endif /* ! ACE_MT_SAFE */
+};
+
+// This is only needed here because we can't afford to call
+// ACE_LOG_MSG->instance() from within ACE_Log_Msg::instance() or else
+// we will recurse infinitely! Not for public use!
+#define ACE_NEW_RETURN_I(POINTER,CONSTRUCTOR,RET_VAL) \
+ do { POINTER = new CONSTRUCTOR; \
+ if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \
+ } while (0)
+
+#endif /* ACE_LOG_MSG_MANAGER_H */
diff --git a/ace/Log_Msg_s.cpp b/ace/Log_Msg_s.cpp
new file mode 100644
index 00000000000..606e01b91cb
--- /dev/null
+++ b/ace/Log_Msg_s.cpp
@@ -0,0 +1,63 @@
+// $Id$
+
+#define ACE_BUILD_DLL
+
+#include "ace/Log_Msg.h"
+#include "ace/Log_Msg_Manager.h"
+
+// Default per-process priority mask
+// By default, no priorities are enabled.
+u_long ACE_Log_Msg::process_priority_mask_ = 0;
+
+// Records the program name.
+const ASYS_TCHAR *ACE_Log_Msg::program_name_ = 0;
+
+// Name of the local host.
+const ASYS_TCHAR *ACE_Log_Msg::local_host_ = 0;
+
+// Process id of the current process.
+pid_t ACE_Log_Msg::pid_ = -1;
+
+// Default is to use stderr.
+u_long ACE_Log_Msg::flags_ = ACE_Log_Msg::STDERR;
+
+// Current offset of msg_[].
+int ACE_Log_Msg::msg_off_ = 0;
+
+// Instance count for Log_Msg - used to know when dynamically
+// allocated storage (program name and host name) can be safely
+// deleted.
+int ACE_Log_Msg::instance_count_ = 0;
+
+// Default per-thread priority mask
+// By default, all priorities are enabled.
+u_long ACE_Log_Msg::default_priority_mask_ = LM_SHUTDOWN
+ | LM_TRACE
+ | LM_DEBUG
+ | LM_INFO
+ | LM_NOTICE
+ | LM_WARNING
+ | LM_STARTUP
+ | LM_ERROR
+ | LM_CRITICAL
+ | LM_ALERT
+ | LM_EMERGENCY;
+
+/* static */
+ACE_LOG_MSG_IPC_STREAM *ACE_Log_Msg_Manager::message_queue_ = 0;
+
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+
+#include "ace/Synch.h"
+
+ACE_Recursive_Thread_Mutex *ACE_Log_Msg_Manager::lock_ = 0;
+
+int ACE_Log_Msg::key_created_ = 0;
+
+# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \
+ defined (ACE_HAS_TSS_EMULATION)
+// This can cause a static constructor (but not destructor) call.
+ACE_thread_key_t ACE_Log_Msg::log_msg_tss_key_ = ACE_OS::NULL_key;
+# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */
+
+#endif /* ACE_MT_SAFE */
diff --git a/ace/OS_s.cpp b/ace/OS_s.cpp
new file mode 100644
index 00000000000..e9ed6d46835
--- /dev/null
+++ b/ace/OS_s.cpp
@@ -0,0 +1,31 @@
+// $Id$
+
+#define ACE_BUILD_DLL
+
+#include "ace/OS.h"
+
+#if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION)
+ ACE_TSS_Cleanup *ACE_TSS_Cleanup::instance_ = 0;
+
+# if defined (ACE_HAS_TSS_EMULATION)
+ u_int ACE_TSS_Emulation::total_keys_ = 0;
+
+ ACE_TSS_Emulation::ACE_TSS_DESTRUCTOR
+ ACE_TSS_Emulation::tss_destructor_
+ [ACE_TSS_Emulation::ACE_TSS_THREAD_KEYS_MAX] = { 0 };
+
+# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
+ int ACE_TSS_Emulation::key_created_ = 0;
+
+ ACE_OS_thread_key_t ACE_TSS_Emulation::native_tss_key_;
+# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */
+
+# endif /* ACE_HAS_TSS_EMULATION */
+#endif /* WIN32 || ACE_HAS_TSS_EMULATION */
+
+ACE_OS_Object_Manager *ACE_OS_Object_Manager::instance_ = 0;
+
+void *ACE_OS_Object_Manager::preallocated_object[
+ ACE_OS_Object_Manager::ACE_OS_PREALLOCATED_OBJECTS] = { 0 };
+
+ACE_EXIT_HOOK ACE_OS::exit_hook_ = 0;
diff --git a/ace/Object_Manager_s.cpp b/ace/Object_Manager_s.cpp
new file mode 100644
index 00000000000..72abca3814f
--- /dev/null
+++ b/ace/Object_Manager_s.cpp
@@ -0,0 +1,13 @@
+// $Id$
+
+#define ACE_BUILD_DLL
+
+#include "ace/Object_Manager.h"
+
+ACE_Object_Manager *ACE_Object_Manager::instance_ = 0;
+
+void *ACE_Object_Manager::preallocated_object[
+ ACE_Object_Manager::ACE_PREALLOCATED_OBJECTS] = { 0 };
+
+void *ACE_Object_Manager::preallocated_array[
+ ACE_Object_Manager::ACE_PREALLOCATED_ARRAYS] = { 0 };