Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: boost::mute...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 13 of 16 Topic 43970 of 48417
Post > Topic >>

Re: boost::mutex - are lock attempts queued?

by Gerhard Fiedler <gelists@[EMAIL PROTECTED] > Mar 19, 2008 at 10:43 AM

On 2008-03-18 12:53:37, Lars Uffmann wrote:

> Fei Liu wrote:
>> lock attempts are never queued. lock is acquired when a lock is not 
>> bound and a thread attempts to acquire it.
> 
> Hmm... I'm not sure what the C++ standardization committee is about to 
> implement, but the "basis" for that implementation in boost seems to be 
> queueing lock attempts:
> 
> - thread a gets a lock on mutex m
> - thread b attempts to acquire a lock on m, and locks
> - thread a unlocks m
> - thread b now gets the lock on m and proceeds
> 
> That's how it is behaving. Just for the record :)

There is no "queue" here. Ok, there is a queue of 1 thread waiting -- but
with one member, there's no difference between a stack, a queue, a set,
...
:)

The thing is if several threads b1, b2, b3, ... are waiting on m (and have
attempted to acquire the lock in that order), there is nothing in the
language that guarantees that they will acquire the lock in that order. If
so, it would be a queue. It's not, so it isn't really a queue.

Gerhard
 




 16 Posts in Topic:
boost::mutex - are lock attempts queued?
Lars Uffmann <aral@[EM  2008-03-18 15:36:14 
Re: boost::mutex - are lock attempts queued?
Lars Uffmann <aral@[EM  2008-03-18 15:53:19 
Re: boost::mutex - are lock attempts queued?
Joe Greer <jgreer@[EMA  2008-03-18 17:27:54 
Re: boost::mutex - are lock attempts queued?
Lars Uffmann <aral@[EM  2008-03-18 17:42:09 
Re: boost::mutex - are lock attempts queued?
Lionel B <me@[EMAIL PR  2008-03-18 15:27:11 
Re: boost::mutex - are lock attempts queued?
Lars Uffmann <aral@[EM  2008-03-18 16:50:24 
Re: boost::mutex - are lock attempts queued?
Lionel B <me@[EMAIL PR  2008-03-18 16:02:54 
Re: boost::mutex - are lock attempts queued?
ytrembla@[EMAIL PROTECTED  2008-04-01 16:45:59 
Re: boost::mutex - are lock attempts queued?
Fei Liu <fei.liu@[EMAI  2008-03-18 11:29:08 
Re: boost::mutex - are lock attempts queued?
Lars Uffmann <aral@[EM  2008-03-18 16:53:37 
Re: boost::mutex - are lock attempts queued?
Paavo Helde <nobody@[E  2008-03-18 14:22:56 
Re: boost::mutex - are lock attempts queued?
Lars Uffmann <aral@[EM  2008-03-19 14:08:12 
Re: boost::mutex - are lock attempts queued?
Gerhard Fiedler <gelis  2008-03-19 10:43:46 
Re: boost::mutex - are lock attempts queued?
ytrembla@[EMAIL PROTECTED  2008-04-01 16:52:09 
Re: boost::mutex - are lock attempts queued?
Szabolcs Ferenczi <sza  2008-03-18 15:44:28 
Re: boost::mutex - are lock attempts queued?
Lars Uffmann <aral@[EM  2008-03-19 14:19:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 9:54:05 CST 2008.