summaryrefslogtreecommitdiff
path: root/ace/Singleton.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1996-11-26 09:39:26 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1996-11-26 09:39:26 +0000
commitbd6ddc52daef2a49e8cc7fc210236d6f75917fff (patch)
tree181a2e9edcb2dd8c227a19ab56ec067f7933d675 /ace/Singleton.cpp
parent7b844f59e70f35915cca9bddbb0691e10221e468 (diff)
downloadATCD-bd6ddc52daef2a49e8cc7fc210236d6f75917fff.tar.gz
eee
Diffstat (limited to 'ace/Singleton.cpp')
-rw-r--r--ace/Singleton.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/ace/Singleton.cpp b/ace/Singleton.cpp
index 5d6a6e8ea31..4a07aedb70c 100644
--- a/ace/Singleton.cpp
+++ b/ace/Singleton.cpp
@@ -44,7 +44,25 @@ ACE_Singleton<TYPE, LOCK>::instance (void)
ACE_GUARD_RETURN (LOCK, ace_mon, ace_singleton_lock_, 0);
if (instance_ == 0)
- ACE_NEW_RETURN (instance_, TYPE, 0);
+ {
+ // We can replace the following lines with this line once we
+ // update the macro in OS.h
+ // ACE_NEW_RETURN (instance_, TYPE, 0);
+
+ instance_ = new TYPE;
+ if (instance_ == 0)
+ {
+ errno = ENOMEM;
+ return 0;
+ }
+ else if (ACE_LOG_MSG->op_status () == -1)
+ {
+ errno = ACE_LOG_MSG->errnum ();
+ delete instance_;
+ instance_ = 0;
+ return 0;
+ }
+ }
}
return instance_;
@@ -56,7 +74,25 @@ ACE_Singleton<TYPE, LOCK>::instance (void)
ACE_GUARD_RETURN (LOCK, ace_mon, (ACE_Singleton<TYPE, LOCK>::ace_singleton_lock_), 0);
if (ACE_Singleton<TYPE, LOCK>::instance_ == 0)
- ACE_NEW_RETURN ((ACE_Singleton<TYPE, LOCK>::instance_), TYPE, 0);
+ {
+ // We can replace the following lines with this line once we
+ // update the macro in OS.h
+ // ACE_NEW_RETURN ((ACE_Singleton<TYPE, LOCK>::instance_), TYPE, 0);
+
+ instance_ = new TYPE;
+ if (instance_ == 0)
+ {
+ errno = ENOMEM;
+ return 0;
+ }
+ else if (ACE_LOG_MSG->op_status () == -1)
+ {
+ errno = ACE_LOG_MSG->errnum ();
+ delete instance_;
+ instance_ = 0;
+ return 0;
+ }
+ }
}
return ACE_Singleton<TYPE, LOCK>::instance_;