how do I listen on a socket without sucking up all the CPU time?

Samuel A. Falvo II kc5tja at garnet.armored.net
Thu Oct 12 17:59:25 EDT 2000


On Tue, 3 Oct 2000 23:16:37 +1300, matt wrote:
>Using select with a timeout of NULL(None) is the nicer way to do things, i.e.
>make select blocking.  It means this thread doesn't have to be limited to just
>that socket.  It obviously becomes a lot more useful.

I've read the select() source in Linux's source code.  From what I can see,
it apparently busy-waits on the selectors you give it -- I don't see any
calls to functions that put the process to sleep.

If I'm wrong on this, and I sure hope I am, could someone please point out
where Linux does put the calling process to sleep?  Maybe I just skipped
over it (I was reading for curiosity anyway).  Quite likely, considering the
complete lack of documentation in it.

-- 
KC5TJA/6, DM13, QRP-L #1447 | Official Channel Saint, *Team Amiga*
Samuel A. Falvo II	    |
Oceanside, CA		    |



More information about the Python-list mailing list