I have the following situation:
There is a thread that reads from a device with a fread call. This call is blocking as long as there is no data send from the device. When I stop this thread it remains hanging inside this thread.
Now I found the following inside the man page of fread:
ERRORS
On all systems that conform to the Single UNIX Specification, the fread() function sets errno as listed for the following conditions:
[EINTR] The read operation was terminated due to the receipt of a signal, and no data was transferred.
That would mean there is a way to interrupt the call from a different thread. But I have no idea how. Can someone tell me how to send a signal to interrupt the fread call? And what signal I need to send?
Update 08-10-10 09:25
I still haven't got it to work. I tryed the kill() and pthread_kill() with different signals. But nothing seems to interrupt the fread() call. The only thing that I got working is killing the entire application, but that's not what I want.