00001 #include "ace_pch.h" 00002 #include "ace/Init_ACE.h" 00003 00004 #include "ace/Object_Manager.h" 00005 00006 #if defined (ACE_LACKS_INLINE_FUNCTIONS) 00007 #include "ace/Init_ACE.i" 00008 #endif /* ACE_LACKS_INLINE_FUNCTIONS */ 00009 00010 ACE_RCSID (ace, 00011 Init_ACE, 00012 "$Id: Init_ACE.cpp,v 1.1.1.2.2.1 2003/03/13 19:44:21 chad Exp $") 00013 00014 // Static data members. 00015 unsigned int ACE_Init_ACE::init_fini_count_ = 0; 00016 00017 int 00018 ACE_Init_ACE::init (void) 00019 { 00020 // Don't use ACE_TRACE, because Object_Manager might not have been 00021 // instantiated yet. 00022 // ACE_TRACE ("ACE_Init_ACE::init"); 00023 00024 ++init_fini_count_; 00025 00026 return ACE_Object_Manager::instance ()->init (); 00027 } 00028 00029 int 00030 ACE_Init_ACE::fini (void) 00031 { 00032 ACE_TRACE ("ACE_Init_ACE::fini"); 00033 00034 if (init_fini_count_ > 0) 00035 { 00036 if (--init_fini_count_ == 0) 00037 return ACE_Object_Manager::instance ()->fini (); 00038 else 00039 // Wait for remaining fini () calls. 00040 return 1; 00041 } 00042 else 00043 // More ACE_Init_ACE::fini () calls than ACE_Init_ACE::init () calls. Bad 00044 // application! 00045 return -1; 00046 }
1.2.14 written by Dimitri van Heesch,
© 1997-2002