[Sigsafe-devel] Re: advogato diary
Status: Pre-Alpha
Brought to you by:
slamb
|
From: Pierre P. <pp...@lu...> - 2004-02-17 19:23:49
|
Scott Lamb wrote: > If you're not using thread cancellation, I think that trick is safe. > But if you're using a thread per connection (and not already using > poll()), adding a poll() before every read() or write() would be > slower - twice the system call overhead. It might be too slow to be > acceptable. If you don't use poll(), I suppose you're kind of screwed. But personally, I think that if you use block on read() and use threads to cope with that, you're already screwed, for other reasons. :-) System call overhead nowadays is almost nil, so that's not a very good reason. Also, I think you might be wrong about the setjmp() trick (which would be the proper trick for read()), read() will return EINTR only if the I/O operation did not complete (look at the implementation of fread() or fwrite() in libc). If you're using the other calls you mention, you should be using the write() trick and you already don't have the race. The trick doesn't work in Cygwin, but handily, Windows doesn't have signals! So you're still good (just put the code in and watch it never do the unsupported thing by never getting a signal). But seeing that you actually report that the trick doesn't work with Cygwin would kind of assume that you can get signals on Cygwin, so I might be wrong here. > btw, feel free to ask anything like this on the sigsafe-devel mailing > list. I'd like to get a discussion going on there. I sent this to the list, but I'm not really interesting on joining that list (I'm on too many already). You can keep on Cc'ing me on this thread though. -- Pierre Phaneuf http://advogato.org/person/pphaneuf/ "I am denial, guilt and fear -- and I control you" |