[LTP] [PATCH v4] openposix: timers/twoevtimers: Wait for both timer signals
Li Wang
li.wang@linux.dev
Wed Oct 14 03:59:26 CEST 2026
> The test arms two timers with the same absolute expiration time and
> then does a single sleep() before checking that both signals arrived.
> sleep() returns as soon as the first signal interrupts it, and the
> kernel delivers the two signals one at a time. This sporadically
> leads to failure:
>
> Caught abort signal
> Test FAILED
>
> even though the second timer fires microseconds later.
>
> Make the counters volatile sig_atomic_t and move the printf() calls
> out of the signal handlers, so that they only touch the counters and
> cannot clobber errno behind nanosleep()'s back.
>
> Arm the timers to expire 50ms from now instead of 3 seconds, so the test
> passes in about 50ms, and lower LONGTIME, the upper bound for when a
> signal does not arrive, from 5 to 3 seconds. Also correct the header
> comment: the timers live in the same process, not in different
> processes, and the test only checks that both of them expire, not that
> they expire at the same time.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
Reviewed-by: Li Wang <li.wang@linux.dev>
--
Regards,
Li Wang
More information about the ltp
mailing list