summaryrefslogtreecommitdiff
path: root/boost/interprocess/sync/shm/named_semaphore.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/interprocess/sync/shm/named_semaphore.hpp')
-rw-r--r--boost/interprocess/sync/shm/named_semaphore.hpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/boost/interprocess/sync/shm/named_semaphore.hpp b/boost/interprocess/sync/shm/named_semaphore.hpp
index c6d3830db5..d952d12e14 100644
--- a/boost/interprocess/sync/shm/named_semaphore.hpp
+++ b/boost/interprocess/sync/shm/named_semaphore.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
@@ -11,7 +11,7 @@
#ifndef BOOST_INTERPROCESS_SHM_NAMED_SEMAPHORE_HPP
#define BOOST_INTERPROCESS_SHM_NAMED_SEMAPHORE_HPP
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#if defined(_MSC_VER)
# pragma once
#endif
@@ -33,13 +33,13 @@ namespace ipcdetail {
class shm_named_semaphore
{
- /// @cond
+ #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//Non-copyable
shm_named_semaphore();
shm_named_semaphore(const shm_named_semaphore &);
shm_named_semaphore &operator=(const shm_named_semaphore &);
- /// @endcond
+ #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
public:
shm_named_semaphore(create_only_t, const char *name, unsigned int initialCount, const permissions &perm = permissions());
@@ -57,7 +57,7 @@ class shm_named_semaphore
static bool remove(const char *name);
- /// @cond
+ #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
private:
friend class interprocess_tester;
void dont_close_on_destruction();
@@ -65,9 +65,10 @@ class shm_named_semaphore
interprocess_semaphore *semaphore() const
{ return static_cast<interprocess_semaphore*>(m_shmem.get_user_address()); }
- managed_open_or_create_impl<shared_memory_object> m_shmem;
+ typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> open_create_impl_t;
+ open_create_impl_t m_shmem;
typedef named_creation_functor<interprocess_semaphore, int> construct_func_t;
- /// @endcond
+ #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
};
inline shm_named_semaphore::~shm_named_semaphore()
@@ -81,8 +82,7 @@ inline shm_named_semaphore::shm_named_semaphore
: m_shmem (create_only
,name
,sizeof(interprocess_semaphore) +
- managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoCreate, initialCount)
@@ -94,8 +94,7 @@ inline shm_named_semaphore::shm_named_semaphore
: m_shmem (open_or_create
,name
,sizeof(interprocess_semaphore) +
- managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoOpenOrCreate, initialCount)
@@ -121,13 +120,7 @@ inline bool shm_named_semaphore::try_wait()
{ return semaphore()->try_wait(); }
inline bool shm_named_semaphore::timed_wait(const boost::posix_time::ptime &abs_time)
-{
- if(abs_time == boost::posix_time::pos_infin){
- this->wait();
- return true;
- }
- return semaphore()->timed_wait(abs_time);
-}
+{ return semaphore()->timed_wait(abs_time); }
inline bool shm_named_semaphore::remove(const char *name)
{ return shared_memory_object::remove(name); }