Boost logo

Boost Users :

Subject: [Boost-users] [thread] locking and time
From: Ernst Murnleitner (mur_at_[hidden])
Date: 2008-12-31 16:24:53


Hello,

I have some questions about threads. It would be very nice if somebody could
clarify.

1) recursive_timed_mutex: It is possible to use a time period for locking of a
recursive_timed_mutex by using the approprioate timed_lock(). But there is not
lock class with such a constructor?
2) (recursive timed) shared mutex: Is it not possible to lock with a period of
time instead of ptime?
3) change of system time: What happens in a timed_lock if the system time is
advanced by e.g. one hour? Is there a difference of using ptime or time_period?
4) read/writer mutex: if there are some recursive locks by one thread and this
thread should become the writer, do I run in a deadlock?
5) What is the meaning of the various ..._lock_t (e.g. )? Is there a
documentation?

ad 1)

There seems only to be a constructor with ABSOLUTE time:

 unique_lock(Lockable & m,boost::system_time const& abs_time)

 ad 2)
 
 There seems no possibility to use boost::posix_time::time_period for locking.
 
 ad 3)
 
 If the clock is set to one hour in the future. I think a timed_lock could take
one hour at this moment? If yes, does it happen also if I give a time period?
 
ad 4)
if it is possible to recusively lock in one thread, it should be possible to
make the thread a writtrer thread (exclusive owner) independently on how often
it was locked before. Is this possible?

 ad 5)

 Only internal usage?:
  
unique_lock(Lockable& m_,adopt_lock_t);
unique_lock(Lockable& m_,defer_lock_t);
unique_lock(Lockable& m_,try_to_lock_t)

    
Thank you in advance,
Greetings,

Ernst

 


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net