Subj : Re: Threading and Timeouts To : comp.programming.threads From : Giancarlo Niccolai Date : Thu Jul 21 2005 01:20 am Marcin 'Qrczak' Kowalczyk wrote: > Giancarlo Niccolai writes: > >> If any of this weren't the case, then the POSIX specifications about >> select() wouldn't be possibly fulfilled, as it explicitly says that after >> that select() declares a socket ready, it MUST NOT BLOCK the very next >> operation for which select() was queried . > > POSIX specification for write() says that for pipes and fifos a > partial write is only possible with O_NONBLOCK set. It implies that > this is true also for other descriptors which are not files, e.g.: > > When attempting to write to a file descriptor (other than a pipe > or > FIFO) that supports non-blocking writes and cannot accept the > data immediately: > > * If the O_NONBLOCK flag is clear, write() shall block the > calling > thread until the data can be accepted. > > * If the O_NONBLOCK flag is set, write() shall not block the > thread. > If some data can be written without blocking the thread, > write() shall write what it can and return the number of bytes > written. Oth- erwise, it shall return -1 and set errno to > [EAGAIN]. > Yes. It specifically cites pipe and FIFO writes as exceptions; for normal files and sockets (and for reads), the behavior is what I have described. So this does not invalidates what I am saying. Bests, Giancarlo. .