diff options
author | dhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-05-20 01:15:10 +0000 |
---|---|---|
committer | dhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-05-20 01:15:10 +0000 |
commit | ee6b298b8d435a26df3715ad488c5afa67965ae9 (patch) | |
tree | a4cd3a1a8098feaaf49e4e7cf943bb4babacecf4 /tests/Test_Output.cpp | |
parent | a516b79bbd08683867a8c5570b2327b5630fdc29 (diff) | |
download | ATCD-ee6b298b8d435a26df3715ad488c5afa67965ae9.tar.gz |
ChangeLogTag:Tue May 20 01:10:42 UTC 2003 Don Hinton <dhinton@dresystems.com
Diffstat (limited to 'tests/Test_Output.cpp')
-rw-r--r-- | tests/Test_Output.cpp | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/tests/Test_Output.cpp b/tests/Test_Output.cpp index 36354ccb894..42c4e752a2c 100644 --- a/tests/Test_Output.cpp +++ b/tests/Test_Output.cpp @@ -24,7 +24,7 @@ #include "ace/Log_Msg.h" #include "ace/ACE.h" -static ACE_Test_Output Test_Output; +ACE_Test_Output *ACE_Test_Output::instance_ = 0; ACE_Test_Output::ACE_Test_Output (void) : output_file_ (0) @@ -145,7 +145,39 @@ ACE_Test_Output::close (void) ACE_Test_Output* ACE_Test_Output::instance () { - return &Test_Output; + if (ACE_Test_Output::instance_ == 0) + { + // Perform Double-Checked Locking Optimization. + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, + *ACE_Static_Object_Lock::instance (), 0)); + + if (ACE_Test_Output::instance_ == 0) + { + ACE_NEW_RETURN (ACE_Test_Output::instance_, + ACE_Test_Output, + 0); + //ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Test_Output, ACE_Test_Output::instance_) + } + } + return ACE_Test_Output::instance_; +} + +const ACE_TCHAR * +ACE_Test_Output::dll_name (void) +{ + return ACE_TEXT ("Test_Output"); +} + +const ACE_TCHAR * +ACE_Test_Output::name (void) +{ + return ACE_TEXT ("ACE_Test_Output"); +} + +void +ACE_Test_Output::close_singleton (void) +{ + delete ACE_Test_Output::instance (); } void @@ -171,3 +203,8 @@ randomize (int array[], size_t size) } } +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + template class ACE_Framework_Component_T<ACE_Test_Output>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate ACE_Framework_Component_T<ACE_Test_Output>; +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ |