As the title says, how can I cancel a blocking call such as select() or (in the case of serial comm and similar) read() from another thread? What is the traditional way of solving things like this? I suppose one could use a small timeout and that would probably work fine but that seems like a bit of a hack to me.
Share
The traditional way of interrupting
select(2)is theself-pipe trick. The input/output calls are better served by having the descriptors non-blocking and handlingEAGAIN.