Boost logo

Boost :

From: vicente.botet (vicente.botet_at_[hidden])
Date: 2008-05-04 05:49:41

----- Original Message -----
From: "Anthony Williams" <anthony_w.geo_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, May 03, 2008 10:50 PM
Subject: Re: [boost] [thread] Could mutex and condition_variable be movable?

> "vicente.botet" <vicente.botet_at_[hidden]> writes:
>> I'm defining a class that is non copiable but movable. The class contains
>> a
>> boost::mutex and boost::condition_variable fields which are non copiable
>> neither movable. I'd prefere not been forced to allocate all the class
>> data
>> in a pointer to make possible the move operation.
> These classes cannot be made movable without forcing an additional level
> of
> indirection, since e.g. pthread_mutex_t is not movable.

Thanks, this is what I suspected. I would add the additional level of
indirection on my own class.

> I would imagine that it is unsafe to move an object if other threads might
> be
> accessing it concurrently, since you will be moving the data that they are
> referencing. If there are no other threads, then you can just construct a
> new
> condition_variable or mutex in the destination.

Yes, you are right. I know what you have done to make booost::thread

Thanks again.


Boost list run by bdawes at, gregod at, cpdaniel at, john at