00001 // -*- C++ -*- 00002 // 00003 // Process_Mutex.inl,v 4.7 2005/10/28 16:14:54 ossama Exp 00004 00005 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00006 00007 #if !defined (_ACE_USE_SV_SEM) 00008 ACE_INLINE const ACE_mutex_t & 00009 ACE_Process_Mutex::lock (void) const 00010 { 00011 // ACE_TRACE ("ACE_Process_Mutex::lock"); 00012 return this->lock_.lock (); 00013 } 00014 #endif /* !_ACE_USE_SV_SEM */ 00015 00016 // Explicitly destroy the mutex. 00017 ACE_INLINE int 00018 ACE_Process_Mutex::remove (void) 00019 { 00020 return this->lock_.remove (); 00021 } 00022 00023 // Acquire lock ownership (wait on priority queue if necessary). 00024 ACE_INLINE int 00025 ACE_Process_Mutex::acquire (void) 00026 { 00027 #if defined (_ACE_USE_SV_SEM) 00028 return this->lock_.acquire (0, SEM_UNDO); 00029 #else 00030 return this->lock_.acquire (); 00031 #endif // _ACE_USE_SV_SEM 00032 } 00033 00034 // Acquire lock ownership (wait on priority queue if necessary). 00035 ACE_INLINE int 00036 ACE_Process_Mutex::acquire (ACE_Time_Value &tv) 00037 { 00038 #if !defined (_ACE_USE_SV_SEM) 00039 return this->lock_.acquire (tv); 00040 #else 00041 ACE_UNUSED_ARG (tv); 00042 ACE_NOTSUP_RETURN (-1); 00043 #endif /* !_ACE_USE_SV_SEM */ 00044 } 00045 00046 // Conditionally acquire lock (i.e., don't wait on queue). 00047 ACE_INLINE int 00048 ACE_Process_Mutex::tryacquire (void) 00049 { 00050 #if defined (_ACE_USE_SV_SEM) 00051 return this->lock_.tryacquire (0, SEM_UNDO); 00052 #else 00053 return this->lock_.tryacquire (); 00054 #endif // _ACE_USE_SV_SEM 00055 } 00056 00057 // Release lock and unblock a thread at head of priority queue. 00058 ACE_INLINE int 00059 ACE_Process_Mutex::release (void) 00060 { 00061 #if defined (_ACE_USE_SV_SEM) 00062 return this->lock_.release (0, SEM_UNDO); 00063 #else 00064 return this->lock_.release (); 00065 #endif // _ACE_USE_SV_SEM 00066 } 00067 00068 // Acquire lock ownership (wait on priority queue if necessary). 00069 ACE_INLINE int 00070 ACE_Process_Mutex::acquire_read (void) 00071 { 00072 #if defined (_ACE_USE_SV_SEM) 00073 return this->lock_.acquire_read (0, SEM_UNDO); 00074 #else 00075 return this->lock_.acquire_read (); 00076 #endif // _ACE_USE_SV_SEM 00077 } 00078 00079 // Acquire lock ownership (wait on priority queue if necessary). 00080 ACE_INLINE int 00081 ACE_Process_Mutex::acquire_write (void) 00082 { 00083 #if defined (_ACE_USE_SV_SEM) 00084 return this->lock_.acquire_write (0, SEM_UNDO); 00085 #else 00086 return this->lock_.acquire_write (); 00087 #endif // _ACE_USE_SV_SEM 00088 } 00089 00090 // Conditionally acquire a lock (i.e., won't block). 00091 ACE_INLINE int 00092 ACE_Process_Mutex::tryacquire_read (void) 00093 { 00094 #if defined (_ACE_USE_SV_SEM) 00095 return this->lock_.tryacquire_read (0, SEM_UNDO); 00096 #else 00097 return this->lock_.tryacquire_read (); 00098 #endif // _ACE_USE_SV_SEM 00099 } 00100 00101 // Conditionally acquire a lock (i.e., won't block). 00102 ACE_INLINE int 00103 ACE_Process_Mutex::tryacquire_write (void) 00104 { 00105 #if defined (_ACE_USE_SV_SEM) 00106 return this->lock_.tryacquire_write (0, SEM_UNDO); 00107 #else 00108 return this->lock_.tryacquire_write (); 00109 #endif // _ACE_USE_SV_SEM 00110 } 00111 00112 ACE_INLINE int 00113 ACE_Process_Mutex::tryacquire_write_upgrade (void) 00114 { 00115 return 0; 00116 } 00117 00118 ACE_END_VERSIONED_NAMESPACE_DECL