[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] pthread_cond_timedwait realtime clock race



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi everyone,

I was working on a way to come up with a patch to fix this issue. It
gets a bit complicated to set the pthread condition attributes in
evthread_posix_cond_wait() since a condition attribute needs to be set
and used to initialize the condition. I would rather not re-initialize
the condition arguments (cond_) since it's set by the caller.

I was thinking that maybe we could simply set the monotonic clock
source, if available, by default in the evthread_posix_cond_alloc().

Does it makes sense? Thoughts?

Thanks!
David

On 18/09/12 04:29 PM, Nick Mathewson wrote:
> On Tue, Sep 18, 2012 at 4:14 PM, David Goulet <dgoulet@xxxxxxxxx>
> wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
>> 
>> Hi everyone,
>> 
>> I'm David from the LTTng project (http://lttng.org). I'm sharing
>> here an issue we ran into. The solution could benefit the
>> libevent project.
> 
> Hi, and thanks for the heads-up!
> 
> [...]
>> After some research, we discovered a fantastic call, 
>> pthread_condattr_setclock() which can be used to set the
>> condition to use the CLOCK_MONOTONIC hence having the guarantee
>> to never jump in time between calls.
> [...]
> 
> It looks like the only current user of a timed wait function in 
> Libevent is the unit tests.  That doesn't mean we shouldn't fix
> this, though.  Anybody want to come up with a patch?
> 
> yrs,
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJQW4DMAAoJEELoaioR9I02uNsIAIbyTwMqMzLI1dDuKxCWZCXL
CfAfKGbz3f9+9JR4BkgKTKyyOxf5F49x0y6fI6SNpLYQMnqIr0LAUbXwJIt0vIXZ
QcMgTKTN1fi2ja23iOOXyopWtfcpn1WgAOU1aHZGMTms5zs4co+e+a7i9NkfnJDC
07q7Cdc4TTAJL0fKkhnyuoj5x0u8OHKfjbtBHHYW7jhuLIGN0dx5zGv2Iy5S3qlA
lamCSAQQVOFI8ibL8CVDpxSuNeisGPg+I8KTLt4oHLVfJwYbQtDy6ZyWVNa7YPyS
CUhBnwJCKWriHoAwkTSktDssA5/erVM/wmDiTuJr3wt61HEbmt0W+sydHf51/qY=
=q8q7
-----END PGP SIGNATURE-----
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.