[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: pthread_cond_timedwait() returns ESRCH
2011/3/17 Sad Clouds <cryintothebluesky%googlemail.com@localhost>:
> On Thu, 17 Mar 2011 19:35:12 +0200
> Stathis Kamperis <ekamperi%gmail.com@localhost> wrote:
>> 2011/3/17 Sad Clouds <cryintothebluesky%googlemail.com@localhost>:
>> > On Thu, 17 Mar 2011 17:02:46 +0000
>> > Sad Clouds <cryintothebluesky%googlemail.com@localhost> wrote:
>> >> Hi, I'm trying to figure out why pthread_cond_timedwait() sometimes
>> >> returns error code 3 (ESRCH). Anyone knows under what circumstances
>> >> this can happen?
>> > OK I think I know what might be causing this. I was taking current
>> > time snapshot with clock_gettime(CLOCK_MONOTONIC, &ts) and I think
>> > NetBSD pthreads implementation wants CLOCK_REALTIME. There appears
>> > to be no pthread_condattr_setclock() function, so CLOCK_REALTIME is
>> > probably the only option.
>> > It might be useful to add this info to pthread_cond_timedwait man
>> > page, as it's very easy to mix up the clock types.
>> Just to make sure --
>> you do know that the timeout parameter is the absolute time (time
>> since Epoch), right ?
> Well, I didn't know it had to be time since Epoch. You can have absolute
> timeout with CLOCK_MONOTONIC, provided pthreads implementation can
> distinguish between CLOCK_REALTIME and CLOCK_MONOTONIC.
You can query host OS with sysconf(_SC_MONOTONIC_CLOCK) to see if
latter is supported.
Main Index |
Thread Index |