Self-pipe trick (and failings)
Posted Apr 6, 2006 10:09 UTC (Thu) by renox
In reply to: Self-pipe trick (and failings)
Parent article: The new pselect() system call
> Yes, it takes some code, but it only needs to be written and debugged once.
Well does glibc includes it?
No because the self-pipe trick cannot really be put into a library: it play tricks with signals, pipes which could have impact in your code, so each userspace program which need it must reimplement it, I'd hardly call this 'once'.
Whereas kernel implementation is really unique, so it is really better.
Plus it is conforming to POSIX standard, even better!
That said I find quite awful that glibc would implement pselect leaving the unsuspecting developer vulnerable to the race condition, it should be either implemented in the kernel or not at all (unless the library find a way to close the race condition of course).
to post comments)