Static_Object_Lock.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Static_Object_Lock.h
00006  *
00007  *  Static_Object_Lock.h,v 1.3 2005/10/28 16:14:55 ossama Exp
00008  *
00009  *  @author David L. Levine <levine@cs.wustl.edu>
00010  *  @author Matthias Kerkhoff
00011  *  @author Per Andersson
00012  */
00013 //=============================================================================
00014 
00015 #ifndef ACE_STATIC_OBJECT_LOCK_H
00016 #define ACE_STATIC_OBJECT_LOCK_H
00017 #include /**/ "ace/pre.h"
00018 
00019 #include "ace/ACE_export.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #if defined (ACE_HAS_THREADS)
00026 
00027 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00028 
00029 class ACE_Recursive_Thread_Mutex;
00030 
00031 /**
00032  * @class ACE_Static_Object_Lock
00033  *
00034  * @brief Provide an interface to access a global lock.
00035  *
00036  * This class is used to serialize the creation of static
00037  * singleton objects.  It really isn't needed any more, because
00038  * anyone can access ACE_STATIC_OBJECT_LOCK directly.  But, it
00039  * is retained for backward compatibility.
00040  */
00041 class ACE_Export ACE_Static_Object_Lock
00042 {
00043 public:
00044   /// Static lock access point.
00045   static ACE_Recursive_Thread_Mutex *instance (void);
00046 
00047   /// For use only by ACE_Object_Manager to clean up lock if it
00048   /// what dynamically allocated.
00049   static void cleanup_lock (void);
00050 };
00051 
00052 ACE_END_VERSIONED_NAMESPACE_DECL
00053 
00054 #endif /* ACE_HAS_THREADS */
00055 
00056 // hack to get around errors while compiling using split-cpp
00057 #if defined (ACE_HAS_THREADS)
00058 
00059 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00060 
00061 # if defined (ACE_IS_SPLITTING)
00062 typedef ACE_Cleanup_Adapter<ACE_Recursive_Thread_Mutex> ACE_Static_Object_Lock_Type;
00063 
00064 #  if defined (__GNUC__)
00065 // With g++, suppress the warning that this is unused.
00066 static ACE_Static_Object_Lock_Type *ACE_Static_Object_Lock_lock __attribute__ ((unused)) = 0;
00067 #  else
00068 static ACE_Static_Object_Lock_Type *ACE_Static_Object_Lock_lock = 0;
00069 #  endif /* __GNUC__ */
00070 
00071 # endif /* ACE_IS_SPLITTING */
00072 
00073 ACE_END_VERSIONED_NAMESPACE_DECL
00074 
00075 #endif /* ACE_HAS_THREADS */
00076 
00077 #include /**/ "ace/post.h"
00078 #endif /* ACE_STATIC_OBJECT_LOCK_H */

Generated on Thu Nov 9 09:42:04 2006 for ACE by doxygen 1.3.6