Boost logo

Threads-Devel :

Subject: Re: [Threads-devel] Fwd: cond.timed_wait() returns way after deadline?
From: Stefan Steuerwald (salsasepp_at_[hidden])
Date: 2009-07-10 05:14:06


Thank you for your comments, for curiosity I have tested both
orderings, no apparent difference.
My predicate has nothing to do with the notify code anyway.

I can just do an isolated cond.timed_wait() call, and sometimes the
deadline just passes, and it still sits there!!!
I have verified that my clock is unchanged. No clue yet.

Thanks,
  Stefan.

2009/7/9 Frank Mori Hess <frank.hess_at_[hidden]>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Thursday 09 July 2009, Frank Mori Hess wrote:
>> On Thursday 09 July 2009, Stefan Steuerwald wrote:
>> >
>> > Sorry, right. It looks like this:
>> >
>> >     unique_lock<mutex> lock(mut);
>> >     // some variable updates here
>> >     lock.unlock();
>> >     cond.notify_all();
>>
>> Is there any reason you unlock before calling notify_all?  I know it is
>> supposed to work, but you could in principle go back to waiting after a
>> notify if the predicate is made true by one thread then a different thread
>> makes if false again before the timed_wait receives the notify and
>> reacquires the mutex.
>
> Err, nevermind.  It seems if two threads are toggling the predicate moving the
> notify inside the scoped lock still wouldn't help.
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkpV9wwACgkQ5vihyNWuA4XfsQCgiX7rgJXQatH6A8Xi6wx86FgE
> JDoAoKA3qE3CqXkVUnnQOpssAQNL+472
> =H8H5
> -----END PGP SIGNATURE-----
> _______________________________________________
> threads-devel mailing list
> threads-devel_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/threads-devel
>


Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk