I read in a lot of place (and sometimes see in code) the idea that closing a file number in some thread of a process will immediately cancel and unblock any I/O blocking call on that file (regular file, socket, or something else) made by another thread.
However I couldn't file either any normative reference guaranteeing that it will happen, or even linux specific documentation that it is the case by design and not by accident.
Is the practice rooted in simple tradition, and inherently unsafe in all cases, or it is somehow guaranteed to work?
(Anyhow, the idea is inherently unsafe in practical multi-threaded code with any part you don't control fully, as you can't know when other threads might re-use that given fileno. I'm not recommending it.)