annotate DEPENDENCIES/generic/include/boost/interprocess/sync/posix/semaphore.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 //////////////////////////////////////////////////////////////////////////////
Chris@16 2 //
Chris@16 3 // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
Chris@16 4 // Software License, Version 1.0. (See accompanying file
Chris@16 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6 //
Chris@16 7 // See http://www.boost.org/libs/interprocess for documentation.
Chris@16 8 //
Chris@16 9 //////////////////////////////////////////////////////////////////////////////
Chris@16 10
Chris@16 11 #ifndef BOOST_INTERPROCESS_POSIX_SEMAPHORE_HPP
Chris@16 12 #define BOOST_INTERPROCESS_POSIX_SEMAPHORE_HPP
Chris@16 13
Chris@101 14 #ifndef BOOST_CONFIG_HPP
Chris@101 15 # include <boost/config.hpp>
Chris@101 16 #endif
Chris@101 17 #
Chris@101 18 #if defined(BOOST_HAS_PRAGMA_ONCE)
Chris@16 19 # pragma once
Chris@16 20 #endif
Chris@16 21
Chris@16 22 #include <boost/interprocess/detail/config_begin.hpp>
Chris@16 23 #include <boost/interprocess/detail/workaround.hpp>
Chris@16 24
Chris@16 25 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
Chris@16 26 #include <boost/interprocess/sync/posix/semaphore_wrapper.hpp>
Chris@16 27
Chris@16 28 namespace boost {
Chris@16 29 namespace interprocess {
Chris@16 30 namespace ipcdetail {
Chris@16 31
Chris@16 32 class posix_semaphore
Chris@16 33 {
Chris@16 34 posix_semaphore();
Chris@16 35 posix_semaphore(const posix_semaphore&);
Chris@16 36 posix_semaphore &operator= (const posix_semaphore &);
Chris@16 37
Chris@16 38 public:
Chris@16 39 posix_semaphore(unsigned int initialCount)
Chris@16 40 { semaphore_init(&m_sem, initialCount); }
Chris@16 41
Chris@16 42 ~posix_semaphore()
Chris@16 43 { semaphore_destroy(&m_sem); }
Chris@16 44
Chris@16 45 void post()
Chris@16 46 { semaphore_post(&m_sem); }
Chris@16 47
Chris@16 48 void wait()
Chris@16 49 { semaphore_wait(&m_sem); }
Chris@16 50
Chris@16 51 bool try_wait()
Chris@16 52 { return semaphore_try_wait(&m_sem); }
Chris@16 53
Chris@16 54 bool timed_wait(const boost::posix_time::ptime &abs_time)
Chris@16 55 { return semaphore_timed_wait(&m_sem, abs_time); }
Chris@16 56
Chris@16 57 private:
Chris@16 58 sem_t m_sem;
Chris@16 59 };
Chris@16 60
Chris@16 61 } //namespace ipcdetail {
Chris@16 62 } //namespace interprocess {
Chris@16 63 } //namespace boost {
Chris@16 64
Chris@16 65 #include <boost/interprocess/detail/config_end.hpp>
Chris@16 66
Chris@16 67 #endif //#ifndef BOOST_INTERPROCESS_POSIX_SEMAPHORE_HPP