]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/interprocess/sync/shm/named_semaphore.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / interprocess / sync / shm / named_semaphore.hpp
index 4ac93e08fd6b903a592d256a4934ed5f41d80de9..9977888bd891423c4c7a877ffc01e504508f5aa7 100644 (file)
@@ -25,7 +25,6 @@
 #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>
@@ -52,15 +51,31 @@ class shm_named_semaphore
 
    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;
@@ -71,7 +86,7 @@ class shm_named_semaphore
 
    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
 };
 
@@ -114,6 +129,43 @@ inline shm_named_semaphore::shm_named_semaphore
                ,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();   }
 
@@ -123,12 +175,20 @@ inline void shm_named_semaphore::wait()
 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 {