Ejemplo n.º 1
0
inline void interprocess_mutex::lock()
{
#ifdef BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING
   boost::posix_time::ptime wait_time
      = boost::posix_time::microsec_clock::universal_time()
        + boost::posix_time::milliseconds(BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS);
   if (!timed_lock(wait_time))
   {
      throw interprocess_exception(timeout_when_locking_error, "Interprocess mutex timeout when locking. Possible deadlock: owner died without unlocking?");
   }
#else
   if (pthread_mutex_lock(&m_mut) != 0) 
      throw lock_exception();
#endif
}
Ejemplo n.º 2
0
 bool timed_lock(Duration const& timeout)
 {
     return timed_lock(get_system_time()+timeout);
 }
Ejemplo n.º 3
0
 bool timed_lock_upgrade(TimeDuration const & relative_time)
 {
     return timed_lock(get_system_time()+relative_time);
 }
Ejemplo n.º 4
0
 bool timed_lock(boost::xtime const& timeout)
 {
     return timed_lock(boost::posix_time::ptime(timeout));
 }
 void lock()
 {
     BOOST_VERIFY(timed_lock(::boost::detail::get_system_time_sentinel()));
 }
 bool timed_lock(boost::xtime const& timeout)
 {
     return timed_lock(system_time(timeout));
 }
Ejemplo n.º 7
0
 bool timed_lock(boost::xtime const & absolute_time)
 {
     return timed_lock(system_time(absolute_time));
 }
Ejemplo n.º 8
0
 scoped_timed_lock(TimedMutex& mx, const xtime& xt)
     : m_mutex(mx), m_locked(false)
 {
     timed_lock(xt);
 }