00001 // -*- C++ -*- 00002 00003 //========================================================================== 00004 /** 00005 * @file Null_Condition.h 00006 * 00007 * $Id: Null_Condition.h 78460 2007-05-23 13:33:56Z johnnyw $ 00008 * 00009 * Moved from Synch.h. 00010 * 00011 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> 00012 */ 00013 //========================================================================== 00014 00015 #ifndef ACE_NULL_CONDITION_H 00016 #define ACE_NULL_CONDITION_H 00017 #include /**/ "ace/pre.h" 00018 00019 // All methods in this class are inline, so there is no 00020 // need to import or export on Windows. -- CAE 12/18/2003 00021 #include "ace/Null_Mutex.h" 00022 00023 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00024 # pragma once 00025 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00026 00027 #include "ace/os_include/os_errno.h" 00028 00029 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00030 00031 class ACE_Time_Value; 00032 00033 /** 00034 * @class ACE_Null_Condition 00035 * 00036 * @brief Implement a do nothing ACE_Condition variable wrapper, 00037 * i.e., all methods are no ops. This class is necessary since 00038 * some C++ compilers are *very* lame... 00039 */ 00040 class ACE_Null_Condition 00041 { 00042 public: 00043 ACE_Null_Condition (const ACE_Null_Mutex &m, 00044 const ACE_TCHAR * = 0, 00045 void * = 0) 00046 : mutex_ ((ACE_Null_Mutex &) m) {} 00047 00048 ~ACE_Null_Condition (void) {} 00049 00050 /// Returns 0. 00051 int remove (void) {return 0;} 00052 00053 /// Returns -1 with @c errno == @c ETIME. 00054 int wait (const ACE_Time_Value * = 0) {errno = ETIME; return -1;} 00055 00056 /// Returns -1 with @c errno == @c ETIME. 00057 int wait (ACE_Null_Mutex &, 00058 const ACE_Time_Value * = 0) {errno = ETIME; return -1;} 00059 00060 /// Returns 0. 00061 int signal (void) {return 0;} 00062 00063 /// Returns 0. 00064 int broadcast (void) {return 0;} 00065 ACE_Null_Mutex &mutex (void) {return this->mutex_;}; 00066 00067 /// Dump the state of an object. 00068 void dump (void) const {} 00069 00070 // ACE_ALLOC_HOOK_DECLARE; 00071 // Declare the dynamic allocation hooks. 00072 00073 protected: 00074 ACE_Null_Mutex &mutex_; // Reference to mutex lock. 00075 00076 private: 00077 // = Prevent assignment and initialization. 00078 void operator= (const ACE_Null_Condition &); 00079 ACE_Null_Condition (const ACE_Null_Condition &); 00080 }; 00081 00082 ACE_END_VERSIONED_NAMESPACE_DECL 00083 00084 #include /**/ "ace/post.h" 00085 #endif /* ACE_NULL_CONDITION_H */