sem_timedwait: The semaphore times out when the clock_REALTIME is used.

Adhemerval Zanella adhemerval.zanella@linaro.org
Tue Apr 6 13:30:44 GMT 2021



On 06/04/2021 10:09, y00575850 via Libc-stable wrote:
> 	Dear Carlos,
> When I use sem_timedwait, a time jump will cause the semaphore to time out. 
> While I know that using CLOCK_REALTIME is POSIX-defined behavior, it doesn't 
> fit the actual meaning of this function.To solve this problem, modify the 
> sem_timedwait process, for example: add a switch control. 
> Or add an interface that uses the Clock_MONOTONIC interface.
>

On glibc 2.30 we added the GNU extension sem_clockwait where you can 
specify the clock against which the timeout will be measured.

(I moved this conversation it to libc-help, libc-stable is usually for
discussion regarding backporting and issue against older releases).


More information about the Libc-help mailing list