Hello,
Hi,
I am a newbie to C++ multi threading (did a bit in java) and would like for
information on the following...
consider:-
class MyClass
{
void SetMyObject(SomeClass const& value)
{
boost::mutex::scoped_lock lock(objectMutex);
myObject = value;
}
SomeClass SetMyObject() const
{
boost::mutex::scoped_lock lock(objectMutex);
return myObject;
}
private:
SomeClass myObject;
boost::mutex objectMutex;
};
Say one thread accesses the SetMyObject() , given that there is a lock in
the function, it will also lock the GetMyObject() blocking any other
thread from calling?
This kind of implies that wherever in the object there is a lock, any
function owned by the object will be locked to any other thread trying to
access. Is this correct?
Thanks again for your help.
--
View this message in context: http://www.nabble.com/boost-mutex-locks-tp24406812p24406812.html
Sent from the Boost - Users mailing list archive at Nabble.com.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users