summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2005-05-19 07:33:55 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2005-05-19 07:33:55 +0000
commitc38d5ecd4c9f3885a104bf4b35c918907fb3bfbb (patch)
treedfe7b79d9a6b3b607c31b58f3eea9bad07583e4a /TAO
parenta9e9d11f53973d7b24541e9e86a728edec0e40b0 (diff)
downloadATCD-c38d5ecd4c9f3885a104bf4b35c918907fb3bfbb.tar.gz
ChangeLogTag:Thu May 19 00:29:35 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
Diffstat (limited to 'TAO')
-rw-r--r--TAO/ChangeLog17
-rw-r--r--TAO/tao/TSS_Resources.cpp25
-rw-r--r--TAO/tao/TSS_Resources.h27
3 files changed, 48 insertions, 21 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 70131162487..b7da3d02988 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,20 @@
+Thu May 19 00:29:35 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
+
+ * tao/TSS_Resources.cpp (instance):
+ * tao/TSS_Resources.h (instance):
+
+ Hide TAO_TSS_Singleton behind new TAO_TSS_Resources::instance()
+ method. Addresses multiple TAO_TSS_Singleton template
+ instantiations on platforms/compilers that support symbol
+ hiding, but for which we do not yet have an appropriate
+ *_SINGLETON_DECLARATION() macro, such as g++ 4.0. Fixes
+ problems where an incorrect singleton instance is returned to
+ the caller.
+
+ Removed unnecessary zero pointer check before operator delete()
+ call. Calling operator delete() on a zero pointer is perfectly
+ valid.
+
Wed May 18 16:23:01 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
* TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp:
diff --git a/TAO/tao/TSS_Resources.cpp b/TAO/tao/TSS_Resources.cpp
index 1085b0e68bb..516a081dc82 100644
--- a/TAO/tao/TSS_Resources.cpp
+++ b/TAO/tao/TSS_Resources.cpp
@@ -2,32 +2,43 @@
#include "TSS_Resources.h"
#include "GUIResource_Factory.h"
+#include "TAO_Singleton.h"
+
ACE_RCSID (tao,
TSS_Resources,
"$Id$")
+
TAO_TSS_Resources::TAO_TSS_Resources (void)
: poa_current_impl_ (0)
- , rtscheduler_current_impl_ (0)
- , rtscheduler_previous_current_impl_ (0)
- , default_environment_ (&this->tss_environment_)
+ , rtscheduler_current_impl_ (0)
+ , rtscheduler_previous_current_impl_ (0)
+ , default_environment_ (&this->tss_environment_)
#if (TAO_HAS_CORBA_MESSAGING == 1)
, policy_current_ (&this->initial_policy_current_)
#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
- , gui_resource_factory_ (0)
+ , gui_resource_factory_ (0)
{
}
TAO_TSS_Resources::~TAO_TSS_Resources (void)
{
- if (gui_resource_factory_)
- delete gui_resource_factory_;
- gui_resource_factory_ = 0;
+ delete gui_resource_factory_;
+}
+
+TAO_TSS_Resources *
+TAO_TSS_Resources::instance (void)
+{
+ // Hide the template instantiation to prevent multiple instances
+ // from being created.
+
+ return
+ TAO_TSS_Singleton<TAO_TSS_Resources, TAO_SYNCH_MUTEX>::instance ();
}
// ****************************************************************
diff --git a/TAO/tao/TSS_Resources.h b/TAO/tao/TSS_Resources.h
index fa67eead299..a85d840eb38 100644
--- a/TAO/tao/TSS_Resources.h
+++ b/TAO/tao/TSS_Resources.h
@@ -14,6 +14,7 @@
#ifndef TAO_TAO_TSS_RESOURCES_H
#define TAO_TAO_TSS_RESOURCES_H
+
#include /**/ "ace/pre.h"
#include "tao/Policy_Manager.h"
@@ -23,7 +24,6 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "tao/TAO_Singleton.h"
#include "tao/Environment.h"
#include "tao/TAO_Export.h"
@@ -51,6 +51,9 @@ public:
/// Destructor
~TAO_TSS_Resources (void);
+ /// Return a singleton instance of this class.
+ static TAO_TSS_Resources * instance (void);
+
private:
/// Do not copy TSS resources
@@ -93,24 +96,20 @@ public:
TAO_Policy_Current_Impl * policy_current_;
#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
- /** A factory for creating GUIReactors.
- *
- * GUIResource_Factory has to be stored in TSS, as GUIReactor are operational
- * only in within the context of GUI event loops.
+
+ /// A factory for creating GUIReactors.
+ /**
+ * @c GUIResource_Factory has to be stored in TSS, as GUIReactors
+ * are operational only in within the context of GUI event loops.
*/
- TAO::GUIResource_Factory *gui_resource_factory_;
+ TAO::GUIResource_Factory * gui_resource_factory_;
};
/**
- * @todo TAO_TSS_RESOURCES singleton typedef should go away.
+ * @todo TAO_TSS_RESOURCES typedef should go away. It is deprecated,
+ * and only exists for backward compatibility.
*/
-typedef TAO_TSS_Singleton<TAO_TSS_Resources, TAO_SYNCH_MUTEX>
- TAO_TSS_RESOURCES;
-
-TAO_SINGLETON_DECLARE (TAO_TSS_Singleton,
- TAO_TSS_Resources,
- TAO_SYNCH_MUTEX)
-
+typedef TAO_TSS_Resources TAO_TSS_RESOURCES;
#include /**/ "ace/post.h"