[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pthread_mutex_timedlock with time in past
- Date: Sat, 28 Aug 2010 13:22:57 -0500
- From: joel.sherrill at OARcorp.com (Joel Sherrill)
- Subject: pthread_mutex_timedlock with time in past
On 08/28/2010 12:08 PM, Peter Dufault wrote:
> On Aug 28, 2010, at 10:24 , Joel Sherrill wrote:
>
>
>> I was reviewing this code and wanted to
>> make sure that ...
>>
>> + lock is busy (e.g. unavailable)
>> + absolute time is in the past
>>
>> We should return ETIMEDOUT not EBUSY.
>>
>> The OpenGroup page is this but I am missing
>> the exact phrase which tells us what to do.
>>
> "The *timeout shall expire* when the absolute time specified by abs_timeout passes, as measured by the clock on which timeouts are based (that is, when the value of that clock equals or exceeds abs_timeout), *or if the absolute time specified by abs_timeout has already been passed at the time of the call*."
> ...
> "[ETIMEDOUT]
> The mutex could not be locked before the specified timeout expired."
>
> I think those two imply you should return ETIMEDOUT.
>
>
OK. I will try to propagate the current code to old branches.
Thanks.
> Peter
> -----------------
> Peter Dufault
> HD Associates, Inc. Software and System Engineering
>
>