1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // See http://www.boost.org/libs/interprocess for documentation.
9 //////////////////////////////////////////////////////////////////////////////
11 #ifndef BOOST_INTERPROCESS_POSIX_SEMAPHORE_HPP
12 #define BOOST_INTERPROCESS_POSIX_SEMAPHORE_HPP
18 #include <boost/interprocess/detail/config_begin.hpp>
19 #include <boost/interprocess/detail/workaround.hpp>
21 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
22 #include <boost/interprocess/sync/posix/semaphore_wrapper.hpp>
25 namespace interprocess {
31 posix_semaphore(const posix_semaphore&);
32 posix_semaphore &operator= (const posix_semaphore &);
35 posix_semaphore(unsigned int initialCount)
36 { semaphore_init(&m_sem, initialCount); }
39 { semaphore_destroy(&m_sem); }
42 { semaphore_post(&m_sem); }
45 { semaphore_wait(&m_sem); }
48 { return semaphore_try_wait(&m_sem); }
50 bool timed_wait(const boost::posix_time::ptime &abs_time)
51 { return semaphore_timed_wait(&m_sem, abs_time); }
57 } //namespace ipcdetail {
58 } //namespace interprocess {
61 #include <boost/interprocess/detail/config_end.hpp>
63 #endif //#ifndef BOOST_INTERPROCESS_POSIX_SEMAPHORE_HPP