summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-04-05 17:05:05 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-04-05 17:05:05 +0000
commit0139784279c7b6df7eb1267010eba58c3ef08696 (patch)
treebb4d5ff94d0342f1faa3519122eb9433c4a619be
parentc31a38c07ce8c5ffc4af292cd7babcbef50a4be7 (diff)
downloadATCD-0139784279c7b6df7eb1267010eba58c3ef08696.tar.gz
moved flags members from ACE_Thread_Descriptor to a new ACE_OS_Thread_Descriptor base class, to remove dependency of OS.cpp on Thread_Manager.h
-rw-r--r--ace/OS.cpp20
-rw-r--r--ace/OS.h25
-rw-r--r--ace/OS.i15
-rw-r--r--ace/Thread_Manager.h11
-rw-r--r--ace/Thread_Manager.i13
5 files changed, 56 insertions, 28 deletions
diff --git a/ace/OS.cpp b/ace/OS.cpp
index 8f5669205f9..6129e233a3b 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -12,9 +12,6 @@
#if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION)
# include "ace/Synch_T.h" /* for ACE_TSS */
-# if defined (ACE_WIN32)
-# include "ace/Thread_Manager.h"
-# endif /* ACE_WIN32 */
#endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */
ACE_RCSID(ace, OS, "$Id$")
@@ -2175,7 +2172,10 @@ ACE_Thread_Adapter::inherit_log_msg (void)
// descriptor in.
if (this->thr_desc_ != 0)
- ACE_LOG_MSG->thr_desc (this->thr_desc_);
+ // This downcast is safe. We do it to avoid having to #include
+ // ace/Thread_Manager.h.
+ ACE_LOG_MSG->thr_desc (ACE_reinterpret_cast (ACE_Thread_Descriptor *,
+ this->thr_desc_));
// Block the thread from proceeding until
// thread manager has thread descriptor ready.
@@ -2225,7 +2225,7 @@ ACE_Thread_Adapter::invoke (void)
this->user_func_);
void *arg = this->arg_;
#if defined (ACE_WIN32) && defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0)
- ACE_Thread_Descriptor *thr_desc = this->thr_desc_;
+ ACE_OS_Thread_Descriptor *thr_desc = this->thr_desc_;
#endif /* ACE_WIN32 && ACE_HAS_MFC && (ACE_HAS_MFC != 0) */
// Delete ourselves since we don't need <this> anymore. Make sure
@@ -2399,7 +2399,9 @@ ACE_Thread_Adapter::ACE_Thread_Adapter (ACE_THR_FUNC user_func,
arg_ (arg),
entry_point_ (entry_point),
thr_mgr_ (tm),
- thr_desc_ (td)
+ // An ACE_Thread_Descriptor really is an ACE_OS_Thread_Descriptor.
+ // But without #including ace/Thread_Manager.h, we don't know that.
+ thr_desc_ (ACE_reinterpret_cast (ACE_OS_Thread_Descriptor *,td))
#if !defined (ACE_THREADS_DONT_INHERIT_LOG_MSG)
,
ostream_ (0),
@@ -3293,7 +3295,11 @@ ACE_OS::thr_exit (void *status)
# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0)
int using_afx = -1;
- ACE_Thread_Descriptor *td = ACE_Log_Msg::instance ()->thr_desc ();
+ // An ACE_Thread_Descriptor really is an ACE_OS_Thread_Descriptor.
+ // But without #including ace/Thread_Manager.h, we don't know that.
+ ACE_OS_Thread_Descriptor *td =
+ ACE_reinterpret_cast (ACE_OS_Thread_Descriptor *,
+ ACE_Log_Msg::instance ()->thr_desc ());
if (td)
using_afx = ACE_BIT_ENABLED (td->flags (), THR_USE_AFX);
# endif /* ACE_HAS_MFC && (ACE_HAS_MFC != 0) */
diff --git a/ace/OS.h b/ace/OS.h
index bd46a77472e..933c7a2587f 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -4329,6 +4329,29 @@ public:
// be an extern "C" to make certain compilers happy...
extern "C" ACE_Export void *ace_thread_adapter (void *args);
+class ACE_OS_Thread_Descriptor
+{
+ // = TITLE
+ // Parent class of all ACE_Thread_Descriptor classes.
+ //
+ // =
+ // Container for ACE_Thread_Descriptor members that are
+ // used in ACE_OS.
+public:
+ long flags (void) const;
+ // Get the thread creation flags.
+
+protected:
+ ACE_OS_Thread_Descriptor (long flags = 0);
+ // For use by ACE_Thread_Descriptor.
+
+ long flags_;
+ // Keeps track of whether this thread was created "detached" or not.
+ // If a thread is *not* created detached then if someone calls
+ // <ACE_Thread_Manager::wait>, we need to join with that thread (and
+ // close down the handle).
+};
+
// Forward decl.
class ACE_Thread_Manager;
class ACE_Thread_Descriptor;
@@ -4394,7 +4417,7 @@ private:
ACE_Thread_Manager *thr_mgr_;
// Optional thread manager.
- ACE_Thread_Descriptor *thr_desc_;
+ ACE_OS_Thread_Descriptor *thr_desc_;
// Optional thread descriptor. Passing this pointer in will force
// the spawned thread to cache this location in <Log_Msg> and wait
// until <Thread_Manager> fills in all information in thread
diff --git a/ace/OS.i b/ace/OS.i
index 43164f29135..244090b800a 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -10228,6 +10228,21 @@ ACE_OS::sbrk (int brk)
#endif /* VXWORKS */
}
+ACE_INLINE long
+ACE_OS_Thread_Descriptor::flags (void) const
+{
+ // ACE_TRACE ("ACE_OS_Thread_Descriptor::flags");
+ return flags_;
+}
+
+
+ACE_INLINE
+ACE_OS_Thread_Descriptor::ACE_OS_Thread_Descriptor (long flags)
+ : flags_ (flags)
+{
+}
+
+
ACE_INLINE ACE_Thread_Manager *
ACE_Thread_Adapter::thr_mgr (void)
{
diff --git a/ace/Thread_Manager.h b/ace/Thread_Manager.h
index d3424b6f114..e203e068d35 100644
--- a/ace/Thread_Manager.h
+++ b/ace/Thread_Manager.h
@@ -147,7 +147,7 @@ protected:
#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */
-class ACE_Thread_Descriptor_Base
+class ACE_Thread_Descriptor_Base : public ACE_OS_Thread_Descriptor
{
// = TITLE
// Basic information for thread descriptors. These information
@@ -198,12 +198,6 @@ protected:
// Pointer to an <ACE_Task_Base> or NULL if there's no
// <ACE_Task_Base>.
- long flags_;
- // Keeps track of whether this thread was created "detached" or not.
- // If a thread is *not* created detached then if someone calls
- // <ACE_Thread_Manager::wait>, we need to join with that thread (and
- // close down the handle).
-
ACE_Thread_Descriptor_Base *next_;
ACE_Thread_Descriptor_Base *prev_;
// We need these pointers to maintain the double-linked list in a
@@ -267,9 +261,6 @@ public:
~ACE_Thread_Descriptor (void);
// Do nothing destructor to keep some compilers happy
- long flags (void) const;
- // Get the thread creation flags.
-
void acquire_release (void);
// Do nothing but to acquire the thread descriptor's lock and
// release. This will first check if the thread is registered or
diff --git a/ace/Thread_Manager.i b/ace/Thread_Manager.i
index ada1db1742c..54ceac2638e 100644
--- a/ace/Thread_Manager.i
+++ b/ace/Thread_Manager.i
@@ -92,7 +92,8 @@ ACE_At_Thread_Exit_Func::apply()
ACE_INLINE
ACE_Thread_Descriptor_Base::ACE_Thread_Descriptor_Base (void)
- : thr_id_ (ACE_OS::NULL_thread),
+ : ACE_OS_Thread_Descriptor (),
+ thr_id_ (ACE_OS::NULL_thread),
thr_handle_ (ACE_OS::NULL_hthread),
grp_id_ (0),
thr_state_ (ACE_Thread_Manager::ACE_THR_IDLE),
@@ -159,14 +160,6 @@ ACE_Thread_Descriptor::self (ACE_hthread_t &handle)
handle = this->thr_handle_;
}
-// Get the thread creation
-ACE_INLINE long
-ACE_Thread_Descriptor::flags (void) const
-{
- ACE_TRACE ("ACE_Thread_Descriptor::flag");
- return flags_;
-}
-
#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT)
ACE_INLINE void
ACE_Thread_Descriptor::log_msg_cleanup(ACE_Log_Msg* log_msg)
@@ -188,7 +181,7 @@ ACE_Thread_Descriptor::set_next (ACE_Thread_Descriptor *td)
ACE_INLINE ACE_Thread_Descriptor *
ACE_Thread_Descriptor::get_next (void)
{
- ACE_TRACE ("ACE_Thread_Descriptor::flag");
+ ACE_TRACE ("ACE_Thread_Descriptor::get_next");
return ACE_static_cast (ACE_Thread_Descriptor *, this->next_);
}