How to interrupt blocked thread in Linux domain from Xenomai
Hi,
what is best way to interrupt a blocked RT-Thread waiting on a Linux ressource in secondary mode (e.g. socket) from another NRT-Thread? I can successfully detect the blocked state via rt_task_inquire and testing if XNRELAX is being set. Is kill(pid, SIGINT) the right way to interrupt the blocking system call or are there better ways to do it?
Thanks for you help!
MAN Roland Druckmaschinen AG
Vorsitzender des Aufsichtsrates: Hanno C. Fiedler
Vorstand: Gerd Finkbeiner (Vorsitzender), Dr. Ingo Koch, Dr. Markus Rall, Paul Steidle Sitz der Gesellschaft: Offenbach am Main, Registergericht: Amtsgericht Offenbach HRB-Nr. 42592 USt-Ident-Nr. DE 250200933
Quoted 7 lines · On Tue, May 20, 2008 at 9:19 AM, <[email protected]> wrote:
Hi,
what is best way to interrupt a blocked RT-Thread waiting on a Linux ressource in secondary mode (e.g. socket) from another NRT-Thread? I can successfully detect the blocked state via
rt_task_inquireand testing if XNRELAX is being set. Iskill(pid, SIGINT)the right way to interrupt the blocking system call or are there better ways to do it?
The effect of SIGINT is global, it will unblock all threads in the process. You have to use a custom signal (either SIGUSR1, SIGUSR1 or a real-time signal, those from SIGRTMIN to SIGRTMAX), and define an empty handler for this signal. Then use pthread_kill (instead of kill) to kill only the proper thread.
Signature · 1 line
Gilles