Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to terminate an interrupt handling thread: (3 Items)
   
How to terminate an interrupt handling thread  
I'm looking for a method to terminate a interrupt handling thread that is blocked in the InterruptWait_r function.
The Interrupt thread I created based on the int_thread from http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%
2Fcom.qnx.doc.neutrino_lib_ref%2Fi%2Finterruptwait.html

In the documentation of InterruptWait_r it's written that it returns EINTR if the call was interrupted by a signal.
I tried to trigger that return by sending to that thread a SIGINT with pthread_kill function, but the effect was that 
the entire program was terminated.

Could you help with ideas how to terminate that thread?

Thank you,
Gabriel

Re: How to terminate an interrupt handling thread  
Hi Gabriel,
the default for any signal handling is process termination. I would try to have this thread register a signal handler 
for SIGINT. It can be empty, o just print a message.
If my understanding is correct, then when you send SIGINT particularly to this thread, it would first execute that 
signal handler and then InterruptWait returns with EINTR.

But maybe there are other options. What are you actually trying to achieve? Just want to make sure that your thread is 
in InterruptWait? In that case, you may get that information via DCMD to your own as entry in the proc filesystem (same 
method that pidin uses).

If you give more infos to your use case maybe we can advise different idea.

Regards,
Al
Re: How to terminate an interrupt handling thread  
Hi Al,

You were right. It was missing the registration to a signal handler. Now, it works as expected.
Thank you for your prompt support!

Regards,
Gabriel