[LTP] [PATCH 5/5] open_posix: condvar/schedule: mask SIGALRM in SCHED_OTHER threads

Cyril Hrubis chrubis@suse.cz
Mon Feb 22 17:09:03 CET 2016


Hi!
> Kernel can deliver signal to any thread (usually it's the main).
> If these tests run on single CPU and signal gets delivered to main
> thread with SCHED_OTHER scheduling class then signal handler won't
> run until RT thread occupying CPU completes. Which happens after
> 5 seconds and test fails.
> 
> Mask SIGLARM from SCHED_OTHER (main) thread. Kernel will deliver
> signal to any of RT threads that can handle it.

POSIX explicitly states:

It is not safe to use the pthread_cond_signal() function in a signal
handler that is invoked asynchronously.


I guess that the test could be changed to:

* Lock one high priority thread on cond variable
* Run one low priority thread that does sleep(1) then
  calls pthread_cond_signal()
* Run one bussy loop low priority thread

That way we would avoid the signal handlers entirely. What do you think?

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the Ltp mailing list