#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/permissions.hpp>
#include <boost/interprocess/detail/interprocess_tester.hpp>
-#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
#include <boost/interprocess/sync/interprocess_semaphore.hpp>
shm_named_semaphore(open_only_t, const char *name);
+ #if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
+
+ shm_named_semaphore(create_only_t, const wchar_t *name, unsigned int initialCount, const permissions &perm = permissions());
+
+ shm_named_semaphore(open_or_create_t, const wchar_t *name, unsigned int initialCount, const permissions &perm = permissions());
+
+ shm_named_semaphore(open_only_t, const wchar_t *name);
+
+ #endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
+
~shm_named_semaphore();
void post();
void wait();
bool try_wait();
- bool timed_wait(const boost::posix_time::ptime &abs_time);
+ template<class TimePoint> bool timed_wait(const TimePoint &abs_time);
static bool remove(const char *name);
+ #if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
+
+ static bool remove(const wchar_t *name);
+
+ #endif
+
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
private:
friend class interprocess_tester;
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;
+ typedef named_creation_functor<interprocess_semaphore, unsigned> construct_func_t;
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
};
,construct_func_t(DoOpen, 0))
{}
+#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
+
+inline shm_named_semaphore::shm_named_semaphore
+ (create_only_t, const wchar_t *name, unsigned int initialCount, const permissions &perm)
+ : m_shmem (create_only
+ ,name
+ ,sizeof(interprocess_semaphore) +
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
+ ,read_write
+ ,0
+ ,construct_func_t(DoCreate, initialCount)
+ ,perm)
+{}
+
+inline shm_named_semaphore::shm_named_semaphore
+ (open_or_create_t, const wchar_t *name, unsigned int initialCount, const permissions &perm)
+ : m_shmem (open_or_create
+ ,name
+ ,sizeof(interprocess_semaphore) +
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
+ ,read_write
+ ,0
+ ,construct_func_t(DoOpenOrCreate, initialCount)
+ ,perm)
+{}
+
+inline shm_named_semaphore::shm_named_semaphore
+ (open_only_t, const wchar_t *name)
+ : m_shmem (open_only
+ ,name
+ ,read_write
+ ,0
+ ,construct_func_t(DoOpen, 0))
+{}
+
+#endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
+
inline void shm_named_semaphore::post()
{ semaphore()->post(); }
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)
+template<class TimePoint>
+inline bool shm_named_semaphore::timed_wait(const TimePoint &abs_time)
{ return semaphore()->timed_wait(abs_time); }
inline bool shm_named_semaphore::remove(const char *name)
{ return shared_memory_object::remove(name); }
+#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
+
+inline bool shm_named_semaphore::remove(const wchar_t *name)
+{ return shared_memory_object::remove(name); }
+
+#endif
+
} //namespace ipcdetail {
} //namespace interprocess {
} //namespace boost {