summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
Diffstat (limited to 'ace')
-rw-r--r--ace/ACE_Library.mdpbin163328 -> 163328 bytes
-rw-r--r--ace/Dynamic.cpp2
-rw-r--r--ace/Dynamic.h21
-rw-r--r--ace/Dynamic.i18
-rw-r--r--ace/Svc_Handler.cpp8
5 files changed, 33 insertions, 16 deletions
diff --git a/ace/ACE_Library.mdp b/ace/ACE_Library.mdp
index be7298371ef..1cf17afeee4 100644
--- a/ace/ACE_Library.mdp
+++ b/ace/ACE_Library.mdp
Binary files differ
diff --git a/ace/Dynamic.cpp b/ace/Dynamic.cpp
index a94654b56a8..1cc0bdafd45 100644
--- a/ace/Dynamic.cpp
+++ b/ace/Dynamic.cpp
@@ -9,7 +9,7 @@
#endif /* __ACE_INLINE__ */
ACE_Dynamic::ACE_Dynamic (void)
- : instance_ (0)
+ : is_dynamic_ (0)
{
ACE_TRACE ("ACE_Dynamic::ACE_Dynamic");
}
diff --git a/ace/Dynamic.h b/ace/Dynamic.h
index 569f029b6c6..8411dc9ad25 100644
--- a/ace/Dynamic.h
+++ b/ace/Dynamic.h
@@ -22,7 +22,7 @@
class ACE_Export ACE_Dynamic
// = TITLE
- // Checks to see if a Svc_Handler was dynamically allocated.
+ // Checks to see if an object was dynamically allocated.
//
// = DESCRIPTION
// This class holds the pointer in a thread-safe manner between
@@ -31,17 +31,22 @@ class ACE_Export ACE_Dynamic
public:
ACE_Dynamic (void);
- void *set (void *x);
- // Assign the new pointer to <instance_> in order to keep it safe
- // until we can compare it in the constructor.
+ void set (void);
+ // Sets a flag that indicates that the object was dynamically
+ // created. This method is usually called in operator new and then
+ // checked and reset in the constructor.
- int is_dynamic (void *x);
+ int is_dynamic (void);
// 1 if we were allocated dynamically, else 0.
+ void reset (void);
+ // Resets state flag.
+
private:
- void *instance_;
- // Holds the pointer in a thread-safe manner between the call to
- // operator new and the call to the constructor.
+ int is_dynamic_;
+ // Flag that indicates that the object was dynamically created. This
+ // method is usually called in operator new and then checked and
+ // reset in the constructor.
};
#if defined (__ACE_INLINE__)
diff --git a/ace/Dynamic.i b/ace/Dynamic.i
index 9f051363c30..a8395adc4a5 100644
--- a/ace/Dynamic.i
+++ b/ace/Dynamic.i
@@ -3,16 +3,24 @@
// Dynamic.i
-ACE_INLINE void *
-ACE_Dynamic::set (void *x)
+ACE_INLINE void
+ACE_Dynamic::set (void)
{
ACE_TRACE ("ACE_Dynamic::set");
- return this->instance_ = x;
+ this->is_dynamic_ = 1;
}
ACE_INLINE int
-ACE_Dynamic::is_dynamic (void *x)
+ACE_Dynamic::is_dynamic ()
{
ACE_TRACE ("ACE_Dynamic::is_dynamic");
- return this->instance_ == x;
+ return this->is_dynamic_;
}
+
+ACE_INLINE void
+ACE_Dynamic::reset (void)
+{
+ ACE_TRACE ("ACE_Dynamic::set");
+ this->is_dynamic_ = 0;
+}
+
diff --git a/ace/Svc_Handler.cpp b/ace/Svc_Handler.cpp
index 93638b76c33..ee4113600f9 100644
--- a/ace/Svc_Handler.cpp
+++ b/ace/Svc_Handler.cpp
@@ -85,7 +85,8 @@ ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_2>::operator new (size_t n)
ACE_TRACE ("ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_2>::operator new");
// Allocate the memory and store it (usually in thread-specific
// storage, depending on config flags).
- return ACE_Svc_Handler<ACE_PEER_STREAM_2, ACE_SYNCH_2>::instance ()->set (::new char[n]);
+ ACE_Svc_Handler<ACE_PEER_STREAM_2, ACE_SYNCH_2>::instance ()->set ();
+ return ::new char[n];
}
template <PR_ST_1, ACE_SYNCH_1> void
@@ -132,7 +133,10 @@ ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_2>::ACE_Svc_Handler (ACE_Thread_Manager *tm,
// in the April '96 issue of the C++ Report. We've spruced it up to
// work correctly in multi-threaded programs by using our ACE_TSS
// class.
- this->dynamic_ = ACE_Svc_Handler<ACE_PEER_STREAM_2, ACE_SYNCH_2>::instance()->is_dynamic (this);
+ this->dynamic_ = ACE_Svc_Handler<ACE_PEER_STREAM_2, ACE_SYNCH_2>::instance()->is_dynamic ();
+ if (this->dynamic_)
+ // Make sure to reset the flag
+ ACE_Svc_Handler<ACE_PEER_STREAM_2, ACE_SYNCH_2>::instance()->reset ();
this->closing_ = 0;
}