Article View: news.software.nntp
Article #40538Re: INN maxed? Time to add a Diablo router?
From: Andrew Gierth
Date: Tue, 05 Oct 1999 00:00
Date: Tue, 05 Oct 1999 00:00
61 lines
3801 bytes
3801 bytes
>>>>> "Russ" == Russ Allbery <rra@stanford.edu> writes: >> You have to handle timeouts somehow anyway; you can't just sit >> forever in read(). So you use the same mechanism (whether it's >> poll(), signals, or SO_RCVTIMEO) to handle shutdown too. Russ> Everything I've read on the subject seems to indicate that Russ> signals are the last thing you want to try to use in Russ> combination with threads under most threading models. For signals directed at the whole process I'd agree; but I was thinking of pthread_kill, which damn well ought to work reasonably. I'm probably going to try this out myself (using a timeout thread that goes around sending a signal, via pthread_kill, to all the input threads at some suitable interval). By keeping that signal blocked in the thread except when actually doing reads & writes, and not trying to do anything at all in the signal handler, just using it to force an EINTR return, I think I can keep things clean enough. Russ> For the other two, this is getting into areas of network Russ> programming that I don't know well enough to make informed Russ> choices (need to sit down and spend quality time with Unix Russ> Network Programming and TCP/IP Illustrated at some point). Russ> poll() is essentially like select(), yes? yes Russ> I seem to recall having problems before with sockets returning Russ> ready to write with select() and then still blocking when one Russ> writes to them. yes, that can happen if you write enough data. A workaround might Russ> What are the advantages of poll() over select() beyond the file Russ> descriptor limit thing on Solaris? poll has a cleaner interface, especially when the descriptor space being used is very sparse, but select is more portable (though poll is percolating through even to the pure BSD systems now). Russ> And I assume SO_RCVTIMEO is a socket option, but that's the Russ> only thing I know about it. Where should i look for Russ> documentation? man setsockopt (for what little documentation there is, and assuming your system supports it, which Solaris for example doesn't) On systems that _do_ support it it causes read operations to abort and return EWOULDBLOCK if they end up blocking for more than the specified time (passed as a struct timeval) without receiving data from the protocol. SO_SNDTIMEO does a similar thing for writes (but in that case the timer may be reset every time data is delivered to the protocol, so it may take longer than expected to time out if data is still flowing). -- Andrew.
Technical Details
Message-ID:
<87yadhjv7d.fsf@erlenstar.demon.co.uk>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<foo-0210991412200001@192.168.2.3> <ylr9jbdsan.fsf@windlord.stanford.edu> <7tb517$bsu$1@newssvr02.news.prodigy.com> <ylpuyuakvk.fsf@windlord.stanford.edu> <37f94ee5$0$7742@news.execpc.com> <7tcv4u$te4$1@nnrp1.deja.com> <brad-0510991640350001@brad.techos.skynet.be> <yl1zb9pmx1.fsf@windlord.stanford.edu> <87k8p1ldpk.fsf@erlenstar.demon.co.uk> <ylso3plcg0.fsf@windlord.stanford.edu>Show Full Headers
Complete Article Headers
Message-ID: <87yadhjv7d.fsf@erlenstar.demon.co.uk> Subject: Re: INN maxed? Time to add a Diablo router? Date: Tue, 05 Oct 1999 00:00:00 +0000 From: Andrew Gierth <andrew@erlenstar.demon.co.uk> References: <foo-0210991412200001@192.168.2.3> <ylr9jbdsan.fsf@windlord.stanford.edu> <7tb517$bsu$1@newssvr02.news.prodigy.com> <ylpuyuakvk.fsf@windlord.stanford.edu> <37f94ee5$0$7742@news.execpc.com> <7tcv4u$te4$1@nnrp1.deja.com> <brad-0510991640350001@brad.techos.skynet.be> <yl1zb9pmx1.fsf@windlord.stanford.edu> <87k8p1ldpk.fsf@erlenstar.demon.co.uk> <ylso3plcg0.fsf@windlord.stanford.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 533259573 X-Mayan-Date: Long count = 12.19.6.10.12; tzolkin = 12 Eb; haab = 0 Yax X-Complaints-To: andrew@erlenstar.demon.co.uk Organization: disorganised X-Attribution: AG X-Pgp-0x0E9FFBE9: 87 25 7F 14 41 24 B3 51 E0 19 8B DE 49 74 0C 29 X-P-Persistent-Headers: are a bad idea. Newsgroups: news.software.nntp X-Post-Filter: postfilter v0.6 alpha