diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 13:56:48 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 13:56:48 +0000 |
commit | c4078c377d74290ebe4e66da0b4975da91732376 (patch) | |
tree | 1816ef391e42a07929304908ac0e21f4c2f6cb7b /ACE/ace/Mutex.inl | |
parent | 700d1c1a6be348c6c70a2085e559baeb8f4a62ea (diff) | |
download | ATCD-c4078c377d74290ebe4e66da0b4975da91732376.tar.gz |
swap in externals for ACE and TAO
Diffstat (limited to 'ACE/ace/Mutex.inl')
-rw-r--r-- | ACE/ace/Mutex.inl | 175 |
1 files changed, 0 insertions, 175 deletions
diff --git a/ACE/ace/Mutex.inl b/ACE/ace/Mutex.inl deleted file mode 100644 index eb09217501d..00000000000 --- a/ACE/ace/Mutex.inl +++ /dev/null @@ -1,175 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - - -#include "ace/OS_NS_sys_mman.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_Mutex::acquire_read (void) -{ -// ACE_TRACE ("ACE_Mutex::acquire_read"); -#if defined (ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS) - if (this->process_lock_) - return ACE_OS::mutex_lock (this->process_lock_); -#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */ - return ACE_OS::mutex_lock (&this->lock_); -} - -ACE_INLINE int -ACE_Mutex::acquire_write (void) -{ -// ACE_TRACE ("ACE_Mutex::acquire_write"); -#if defined (ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS) - if (this->process_lock_) - return ACE_OS::mutex_lock (this->process_lock_); -#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */ - return ACE_OS::mutex_lock (&this->lock_); -} - -ACE_INLINE int -ACE_Mutex::tryacquire_read (void) -{ -// ACE_TRACE ("ACE_Mutex::tryacquire_read"); -#if defined (ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS) - if (this->process_lock_) - return ACE_OS::mutex_trylock (this->process_lock_); -#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */ - return ACE_OS::mutex_trylock (&this->lock_); -} - -ACE_INLINE const ACE_mutex_t & -ACE_Mutex::lock (void) const -{ -// ACE_TRACE ("ACE_Mutex::lock"); -#if defined (ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS) - if (this->process_lock_) - return *this->process_lock_; -#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */ - return this->lock_; -} - -ACE_INLINE int -ACE_Mutex::tryacquire_write (void) -{ -// ACE_TRACE ("ACE_Mutex::tryacquire_write"); -#if defined (ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS) - if (this->process_lock_) - return ACE_OS::mutex_trylock (this->process_lock_); -#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */ - return ACE_OS::mutex_trylock (&this->lock_); -} - -ACE_INLINE int -ACE_Mutex::tryacquire_write_upgrade (void) -{ -// ACE_TRACE ("ACE_Mutex::tryacquire_write_upgrade"); - return 0; -} - -ACE_INLINE int -ACE_Mutex::acquire (void) -{ -// ACE_TRACE ("ACE_Mutex::acquire"); -#if defined (ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS) - if (this->process_lock_) - return ACE_OS::mutex_lock (this->process_lock_); -#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */ - return ACE_OS::mutex_lock (&this->lock_); -} - -ACE_INLINE int -ACE_Mutex::acquire (ACE_Time_Value &tv) -{ - // ACE_TRACE ("ACE_Mutex::acquire"); - #if defined (ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS) - if (this->process_lock_) - return ACE_OS::mutex_lock (this->process_lock_, tv); -#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS*/ - return ACE_OS::mutex_lock (&this->lock_, tv); -} - -ACE_INLINE int -ACE_Mutex::acquire (ACE_Time_Value *tv) -{ - #if defined (ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS) - if (this->process_lock_) - return ACE_OS::mutex_lock (this->process_lock_, tv); -#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS*/ - return ACE_OS::mutex_lock (&this->lock_, tv); -} - -ACE_INLINE int -ACE_Mutex::tryacquire (void) -{ -// ACE_TRACE ("ACE_Mutex::tryacquire"); -#if defined (ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS) - if (this->process_lock_) - return ACE_OS::mutex_trylock (this->process_lock_); -#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */ - return ACE_OS::mutex_trylock (&this->lock_); -} - -ACE_INLINE int -ACE_Mutex::release (void) -{ -// ACE_TRACE ("ACE_Mutex::release"); -#if defined (ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS) - if (this->process_lock_) - return ACE_OS::mutex_unlock (this->process_lock_); -#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */ - return ACE_OS::mutex_unlock (&this->lock_); -} - -ACE_INLINE int -ACE_Mutex::remove (void) -{ -// ACE_TRACE ("ACE_Mutex::remove"); - int result = 0; -#if defined (ACE_HAS_PTHREADS) || defined (ACE_HAS_STHREADS) - // In the case of a interprocess mutex, the owner is the first - // process that created the shared memory object. In this case, the - // lockname_ pointer will be non-zero (points to allocated memory - // for the name). Owner or not, the memory needs to be unmapped - // from the process. If we are the owner, the file used for - // shm_open needs to be deleted as well. - if (this->process_lock_) - { - if (this->removed_ == false) - { - this->removed_ = true; - // Only destroy the lock if we're the ones who initialized - // it. - if (!this->lockname_) - ACE_OS::munmap ((void *) this->process_lock_, - sizeof (ACE_mutex_t)); - else - { - result = ACE_OS::mutex_destroy (this->process_lock_); - ACE_OS::munmap ((void *) this->process_lock_, - sizeof (ACE_mutex_t)); - ACE_OS::shm_unlink (this->lockname_); - ACE_OS::free ( - static_cast<void *> ( - const_cast<ACE_TCHAR *> (this->lockname_))); - } - } - } - else - { -#else /* !ACE_HAS_PTHREADS && !ACE_HAS_STHREADS */ - if (this->removed_ == false) - { - this->removed_ = true; - result = ACE_OS::mutex_destroy (&this->lock_); - } -#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */ -#if defined (ACE_HAS_PTHREADS) || defined (ACE_HAS_STHREADS) - } -#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */ - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL |