summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkircher_m <kircher_m@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-11-21 17:34:50 +0000
committerkircher_m <kircher_m@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-11-21 17:34:50 +0000
commita7c4303bba0a6072735e28eec15d574360e46f08 (patch)
tree2e196eec58a3bae5f8ba02e6a182985951baef62
parent9341cf09df21eeef8e9ab339c4909746ac6aa4d7 (diff)
downloadATCD-a7c4303bba0a6072735e28eec15d574360e46f08.tar.gz
ChangeLogTag: Wed Nov 21 11:35:50 2001 Michael Kircher <Michael.Kircher@mchp.siemens.de>
-rw-r--r--ChangeLog32
-rw-r--r--ChangeLogs/ChangeLog-02a32
-rw-r--r--ChangeLogs/ChangeLog-03a32
-rw-r--r--ace/Bound_Ptr.h4
-rw-r--r--ace/Bound_Ptr.i33
-rw-r--r--ace/Future.cpp19
-rw-r--r--ace/Future.h4
-rw-r--r--ace/Refcounted_Auto_Ptr.h4
-rw-r--r--ace/Refcounted_Auto_Ptr.i17
9 files changed, 164 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index d62ec969da1..60ede04ebbc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+Wed Nov 21 11:35:50 2001 Michael Kircher <Michael.Kircher@mchp.siemens.de>
+
+ * ace/Bound_Ptr.h
+ * ace/Bound_Ptr.i
+ * ace/Future.cpp
+ * ace/Future.h
+ * ace/Refcounted_Auto_Ptr.h
+ * ace/Refcounted_Auto_Ptr.i
+
+ Made the memory allocation failure behavior consistent
+ to the behavior prior to the change on Sun Oct 28 13:15:00 2001.
+ Thanks to Christopher Kohlhoff <chris@kohlhoff.com> who prepared
+ this change.
+ The problem was that with the above mentioned change failed
+ allocations would return 0 in either case, if exceptions were
+ enabled by the platform or not. This was incosistent to the
+ behavior before, as new threw bad_alloc on allocation failure
+ when exceptions were supported by the platform.
+
+ To fix this we faced the following forces:
+ - Not to introduce yet another macro
+ - Minimize impact of changes, localize the problem
+ - Keep the new calls wrapped by a ACE_NEW macro to allow
+ users to eventually redefine the macro (using e.g. new (nothrow)
+
+ As the ACE_NEW macros are quite restrictive in their supported
+ semantics, e.g. you can only return on error, we decided to introduce
+ a new method (as inline) internal_create which does the allocation.
+ internal_create is called by create which does the differentiation
+ between the exception-supported and exception-not-supported case.
+
Wed Nov 21 09:07:37 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
* ace/OS.h: Updated the ACE_GUARD_ACTION macro and added a new
@@ -49,6 +80,7 @@ Fri Nov 16 10:39:52 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
not stopped. Thanks to Kyle Brost <Kyle.Brost@quest.com> for
providing this fix.
+>>>>>>> 4.2766
Wed Nov 21 10:00:20 2001 Chad Elliott <elliott_c@ociweb.com>
* ace/config-irix6.x-common.h:
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index d62ec969da1..60ede04ebbc 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,34 @@
+Wed Nov 21 11:35:50 2001 Michael Kircher <Michael.Kircher@mchp.siemens.de>
+
+ * ace/Bound_Ptr.h
+ * ace/Bound_Ptr.i
+ * ace/Future.cpp
+ * ace/Future.h
+ * ace/Refcounted_Auto_Ptr.h
+ * ace/Refcounted_Auto_Ptr.i
+
+ Made the memory allocation failure behavior consistent
+ to the behavior prior to the change on Sun Oct 28 13:15:00 2001.
+ Thanks to Christopher Kohlhoff <chris@kohlhoff.com> who prepared
+ this change.
+ The problem was that with the above mentioned change failed
+ allocations would return 0 in either case, if exceptions were
+ enabled by the platform or not. This was incosistent to the
+ behavior before, as new threw bad_alloc on allocation failure
+ when exceptions were supported by the platform.
+
+ To fix this we faced the following forces:
+ - Not to introduce yet another macro
+ - Minimize impact of changes, localize the problem
+ - Keep the new calls wrapped by a ACE_NEW macro to allow
+ users to eventually redefine the macro (using e.g. new (nothrow)
+
+ As the ACE_NEW macros are quite restrictive in their supported
+ semantics, e.g. you can only return on error, we decided to introduce
+ a new method (as inline) internal_create which does the allocation.
+ internal_create is called by create which does the differentiation
+ between the exception-supported and exception-not-supported case.
+
Wed Nov 21 09:07:37 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
* ace/OS.h: Updated the ACE_GUARD_ACTION macro and added a new
@@ -49,6 +80,7 @@ Fri Nov 16 10:39:52 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
not stopped. Thanks to Kyle Brost <Kyle.Brost@quest.com> for
providing this fix.
+>>>>>>> 4.2766
Wed Nov 21 10:00:20 2001 Chad Elliott <elliott_c@ociweb.com>
* ace/config-irix6.x-common.h:
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index d62ec969da1..60ede04ebbc 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,34 @@
+Wed Nov 21 11:35:50 2001 Michael Kircher <Michael.Kircher@mchp.siemens.de>
+
+ * ace/Bound_Ptr.h
+ * ace/Bound_Ptr.i
+ * ace/Future.cpp
+ * ace/Future.h
+ * ace/Refcounted_Auto_Ptr.h
+ * ace/Refcounted_Auto_Ptr.i
+
+ Made the memory allocation failure behavior consistent
+ to the behavior prior to the change on Sun Oct 28 13:15:00 2001.
+ Thanks to Christopher Kohlhoff <chris@kohlhoff.com> who prepared
+ this change.
+ The problem was that with the above mentioned change failed
+ allocations would return 0 in either case, if exceptions were
+ enabled by the platform or not. This was incosistent to the
+ behavior before, as new threw bad_alloc on allocation failure
+ when exceptions were supported by the platform.
+
+ To fix this we faced the following forces:
+ - Not to introduce yet another macro
+ - Minimize impact of changes, localize the problem
+ - Keep the new calls wrapped by a ACE_NEW macro to allow
+ users to eventually redefine the macro (using e.g. new (nothrow)
+
+ As the ACE_NEW macros are quite restrictive in their supported
+ semantics, e.g. you can only return on error, we decided to introduce
+ a new method (as inline) internal_create which does the allocation.
+ internal_create is called by create which does the differentiation
+ between the exception-supported and exception-not-supported case.
+
Wed Nov 21 09:07:37 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
* ace/OS.h: Updated the ACE_GUARD_ACTION macro and added a new
@@ -49,6 +80,7 @@ Fri Nov 16 10:39:52 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
not stopped. Thanks to Kyle Brost <Kyle.Brost@quest.com> for
providing this fix.
+>>>>>>> 4.2766
Wed Nov 21 10:00:20 2001 Chad Elliott <elliott_c@ociweb.com>
* ace/config-irix6.x-common.h:
diff --git a/ace/Bound_Ptr.h b/ace/Bound_Ptr.h
index 4b5bbec5bed..094bdb6b8d2 100644
--- a/ace/Bound_Ptr.h
+++ b/ace/Bound_Ptr.h
@@ -66,6 +66,10 @@ public:
static int object_was_deleted (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter);
private:
+ /// Allocate a new ACE_Bound_Ptr_Counter<ACE_LOCK> instance, returning NULL
+ /// if it cannot be created.
+ static ACE_Bound_Ptr_Counter<ACE_LOCK> *internal_create (int init_obj_ref_count);
+
/// Reference count of underlying object. Is set to -1 once the object has
/// been destroyed to indicate to all weak pointers that it is no longer valid.
int obj_ref_count_;
diff --git a/ace/Bound_Ptr.i b/ace/Bound_Ptr.i
index 8bacc270309..964c7975dd9 100644
--- a/ace/Bound_Ptr.i
+++ b/ace/Bound_Ptr.i
@@ -6,17 +6,31 @@
#include "Synch_T.h"
template <class ACE_LOCK> inline ACE_Bound_Ptr_Counter<ACE_LOCK> *
-ACE_Bound_Ptr_Counter<ACE_LOCK>::create_strong (void)
+ACE_Bound_Ptr_Counter<ACE_LOCK>::internal_create (int init_obj_ref_count)
{
- // Set initial object reference count to 1.
-
ACE_Bound_Ptr_Counter<ACE_LOCK> *temp = 0;
ACE_NEW_RETURN (temp,
- ACE_Bound_Ptr_Counter<ACE_LOCK> (1),
+ ACE_Bound_Ptr_Counter<ACE_LOCK> (init_obj_ref_count),
0);
return temp;
}
+template <class ACE_LOCK> inline ACE_Bound_Ptr_Counter<ACE_LOCK> *
+ACE_Bound_Ptr_Counter<ACE_LOCK>::create_strong (void)
+{
+ // Set initial object reference count to 1.
+ ACE_Bound_Ptr_Counter<ACE_LOCK> *temp = internal_create (1);
+#if defined (ACE_NEW_THROWS_EXCEPTIONS)
+ if (temp == 0)
+ ACE_throw_bad_alloc;
+#else
+ ACE_ASSERT (temp != 0);
+#endif /* ACE_NEW_THROWS_EXCEPTIONS */
+ return temp;
+}
+
+
+
template <class ACE_LOCK> inline int
ACE_Bound_Ptr_Counter<ACE_LOCK>::attach_strong (ACE_Bound_Ptr_Counter<ACE_LOCK>* counter)
{
@@ -66,10 +80,13 @@ ACE_Bound_Ptr_Counter<ACE_LOCK>::create_weak (void)
{
// Set initial object reference count to 0.
- ACE_Bound_Ptr_Counter<ACE_LOCK> *temp = 0;
- ACE_NEW_RETURN (temp,
- ACE_Bound_Ptr_Counter<ACE_LOCK> (),
- 0);
+ ACE_Bound_Ptr_Counter<ACE_LOCK> *temp = internal_create (0);
+#if defined (ACE_NEW_THROWS_EXCEPTIONS)
+ if (temp == 0)
+ ACE_throw_bad_alloc;
+#else
+ ACE_ASSERT (temp != 0);
+#endif /* ACE_NEW_THROWS_EXCEPTIONS */
return temp;
}
diff --git a/ace/Future.cpp b/ace/Future.cpp
index c132ba240d3..d2f452b1874 100644
--- a/ace/Future.cpp
+++ b/ace/Future.cpp
@@ -62,10 +62,8 @@ ACE_Future_Rep<T>::dump (void) const
}
template <class T> ACE_Future_Rep<T> *
-ACE_Future_Rep<T>::create (void)
+ACE_Future_Rep<T>::internal_create (void)
{
- // Yes set ref count to zero.
-
ACE_Future_Rep<T> *temp = 0;
ACE_NEW_RETURN (temp,
ACE_Future_Rep<T> (),
@@ -74,6 +72,21 @@ ACE_Future_Rep<T>::create (void)
}
template <class T> ACE_Future_Rep<T> *
+ACE_Future_Rep<T>::create (void)
+{
+ // Yes set ref count to zero.
+ ACE_Future_Rep<T> *temp = internal_create ();
+#if defined (ACE_NEW_THROWS_EXCEPTIONS)
+ if (temp == 0)
+ ACE_throw_bad_alloc;
+#else
+ ACE_ASSERT (temp != 0);
+#endif /* ACE_NEW_THROWS_EXCEPTIONS */
+ return temp;
+ }
+
+
+template <class T> ACE_Future_Rep<T> *
ACE_Future_Rep<T>::attach (ACE_Future_Rep<T>*& rep)
{
ACE_ASSERT (rep != 0);
diff --git a/ace/Future.h b/ace/Future.h
index 58f30cdf60a..b0bf55816b3 100644
--- a/ace/Future.h
+++ b/ace/Future.h
@@ -161,6 +161,10 @@ private:
// These methods must go after the others to work around a bug with
// Borland's C++ Builder...
+ /// Allocate a new ACE_Future_Rep<T> instance, returning NULL if it
+ /// cannot be created.
+ static ACE_Future_Rep<T> *internal_create (void);
+
/// Create a ACE_Future_Rep<T> and initialize the reference count.
static ACE_Future_Rep<T> *create (void);
diff --git a/ace/Refcounted_Auto_Ptr.h b/ace/Refcounted_Auto_Ptr.h
index 0e95f360f1e..f28fdc2cbfb 100644
--- a/ace/Refcounted_Auto_Ptr.h
+++ b/ace/Refcounted_Auto_Ptr.h
@@ -133,6 +133,10 @@ private:
// These methods must go after the others to work around a bug with
// Borland's C++ Builder...
+ /// Allocate a new ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> instance,
+ /// returning NULL if it cannot be created.
+ static ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *internal_create (X *p);
+
/// Create a ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> and initialize
/// the reference count.
static ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *create (X *p);
diff --git a/ace/Refcounted_Auto_Ptr.i b/ace/Refcounted_Auto_Ptr.i
index e927cdd4b66..90baf4dac92 100644
--- a/ace/Refcounted_Auto_Ptr.i
+++ b/ace/Refcounted_Auto_Ptr.i
@@ -21,9 +21,8 @@ ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::null (void) const
}
template <class X, class ACE_LOCK> inline ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *
-ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::create (X *p)
+ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::internal_create (X *p)
{
- // Yes set ref count to zero.
ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *temp = 0;
ACE_NEW_RETURN (temp,
(ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>) (p),
@@ -32,6 +31,20 @@ ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::create (X *p)
}
template <class X, class ACE_LOCK> inline ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *
+ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::create (X *p)
+{
+ // Yes set ref count to zero.
+ ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *temp = internal_create (p);
+#if defined (ACE_NEW_THROWS_EXCEPTIONS)
+ if (temp == 0)
+ ACE_throw_bad_alloc;
+#else
+ ACE_ASSERT (temp != 0);
+#endif /* ACE_NEW_THROWS_EXCEPTIONS */
+ return temp;
+}
+
+template <class X, class ACE_LOCK> inline ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *
ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::attach (ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>*& rep)
{
ACE_ASSERT (rep != 0);