Another socket/thread question

Donn Cave donn at drizzle.com
Wed Mar 13 22:44:58 EST 2002


Quoth amuys at shortech.com.au (Andrae Muys):
...
| Far cleaner to open a control pipe to the thread and have the thread
| wait on both the socket and the pipe.  This applies equally to
| multi-process and multi-threaded models.  This has the added advantage
| that you can extend the shutdown protocol to do other things such as
| request status, stats, or state-changes.

Can't argue with that!

| One hassle with this might be x-platform semantics, as I believe
| windows is broken in this regard.  Still I would assume windows can
| still do pid/interface restricted tcp or preferably unix domain
| sockets, which would allow you to emulate the above.

On BeOS, which has I think similar problems, the only option was
a TCP socket.  So I bound to 127.0.0.1, and closed the bind port
after one accept.  I think that's acceptable under the circumstances,
though it would probably not be an acceptable cross-platform solution -
on UNIX, it would be better to use a pipe.

	Donn Cave, donn at drizzle.com



More information about the Python-list mailing list