Suppose there are 2 threads, T1 and T2.
T1 is selecting on a set of sockets and performs corresponding read/write operations. Now if thread T2 wants to close thread T1 (i.e. join it), then how can I do so, if T1 is blocked on select system call? How can I interrupt select call?
Since you just want to kill the thread, this should work.
In T1:
In T2: