open_posix/pthread_sigmask/18-1: Fix race condition in signal thread join
PATCH 1/1 open_posix/pthread_sigmask/18-1: Fix race condition in signal thread join
When WITH_SYNCHRO is defined, the signal sender threads (th_sig1 and th_sig2) may block on sem_wait() after the main loop exits. This causes pthread_join() to hang indefinitely since those threads never wake up.
Post to both semaphores before joining to ensure the signal threads can proceed and exit cleanly.
--- .../conformance/interfaces/pthread_sigmask/18-1.c | 5 +++++ 1 file changed, 5 insertions(+)
testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c +5 -0
@@ -293,6 +293,11 @@ int main(void) }while (do_it); +#ifdef WITH_SYNCHRO +sem_post (&semsig1); +sem_post (&semsig2); +#endif +if ((ret =pthread_join (th_sig1,NULL ))) {UNRESOLVED (ret,"Signal 1 sender thread join failed" ); }
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Wenbo,
Quoted 1 line · Wenbo Ma
open_posix/pthread_sigmask/18-1: Fix race condition in signal thread join
Verdict - Reviewed
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Andrea Cervesato via ltp
AppliedMerged, Thanks!
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp