Interrupt blocking read
I have a thread doing a read
syscall, and I need to interrupt it without terminating the entire process. I have tried registering a dummy handler for SIGINT using sigaction()
(it returns 0, and ^C runs my handler), and then calling pthread_kill
to send SIGINT specifically to the thread in question (it captures pthread_self
prior to the read
call), but the signal handler doesn’t run, and the process appears to be violently terminated, and also something strange happens to the terminal; it stops echoing my input, and I have to exit the sudo
session and restart it.