On May 7, 2006, at 11:17 PM, Simon Wittber wrote:
On 5/8/06, Bob Ippolito <bob@xxxxxxxxxx> wrote:
This looks pretty good. One thing to note however is that you're
going to need to do the select() in a separate thread if you
want it
to be able to wake up the event loop on network events.
Depending on
the way you're using the pygame event loop, this might not work out
so well.
AFAIK, the select.select call doesn't block, which is the only
reason
(that I know of) that It would need to be called in a seperate
thread?
I'm not sure exactly what you mean by this.
select.select blocks exactly no longer than you ask it to.
pygame.event.get blocks until it gets an event. For an application
that mostly just waits for events (mouse, keyboard) via
pygame.event.get is not going to interoperate well with network
events if it only polls the network after some user input. Ideally
for those sorts of applications you would like the network to also
send an event asynchronously to wake up the event loop. That is
only possible with an additional thread given how SDL works.
-bob