From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyril Hrubis Date: Mon, 22 Feb 2016 17:09:03 +0100 Subject: [LTP] [PATCH 5/5] open_posix: condvar/schedule: mask SIGALRM in SCHED_OTHER threads In-Reply-To: <8f6acea2f6a6b01ebe1749926cbcdbbfd635787a.1455875648.git.jstancek@redhat.com> References: <8f6acea2f6a6b01ebe1749926cbcdbbfd635787a.1455875648.git.jstancek@redhat.com> Message-ID: <20160222160903.GD7406@rei> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ltp@lists.linux.it 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