summaryrefslogtreecommitdiff
path: root/tests/Timeprobe_Test.cpp
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-03-19 16:46:52 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-03-19 16:46:52 +0000
commit2410b5f95d9885b24e15bab6fafcfb3664adf445 (patch)
tree022641577b522afad247a2db5e1c7e166a61c893 /tests/Timeprobe_Test.cpp
parent8b842d6eff804aa75ac4a5436be94e7884347f35 (diff)
downloadATCD-2410b5f95d9885b24e15bab6fafcfb3664adf445.tar.gz
added test of ACE_Singleton creation during construction of static
objects. Timeprobes can do that, when they're enabled.
Diffstat (limited to 'tests/Timeprobe_Test.cpp')
-rw-r--r--tests/Timeprobe_Test.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/Timeprobe_Test.cpp b/tests/Timeprobe_Test.cpp
index d9638a9cae9..211a7b48445 100644
--- a/tests/Timeprobe_Test.cpp
+++ b/tests/Timeprobe_Test.cpp
@@ -84,6 +84,19 @@ work (int time)
ACE_OS::sleep (time);
}
+// Test creation of ACE_Singletons during static object construction.
+// Timeprobes can do that, when they're enabled.
+static int
+create_singleton ()
+{
+ int *i = ACE_Singleton <int, ACE_SYNCH_RECURSIVE_MUTEX>::instance ();
+ *i = 3;
+
+ return *i;
+}
+
+int static_singleton_creator = create_singleton ();
+
int
main (int, ASYS_TCHAR *[])
{
@@ -105,3 +118,9 @@ main (int, ASYS_TCHAR *[])
return 0;
}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+ template class ACE_Singleton <int, ACE_SYNCH_RECURSIVE_MUTEX>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+# pragma instantiate ACE_Singleton <int, ACE_SYNCH_RECURSIVE_MUTEX>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */