
28 Jun
2004
28 Jun
'04
5:21 a.m.
John Torjo wrote:
Batov, Vladimir wrote:
class writer_lock : public boost::mutex::scoped_lock { typedef boost::mutex::scoped_lock super;
public:
writer_lock(rw_mutex& mutex) : super(mutex.mutex_),
mutex_(mutex)
{ ++mutex_.num_writers_; // Make new readers wait.
^^^^
just curios, shouldn't this be thread-safe?
I believe it is thread-safe as writer_lock currently inherits from scoped_lock and, consequently, we get inside the writer_lock constructor after its base-class scoped_lock constructor. The base-class constructor does the synchronization.
7651
Age (days ago)
7651
Last active (days ago)
0 comments
1 participants
participants (1)
-
Batov, Vladimir