[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Is pygame event thread save? or I need use lock to post user event in thread?



halida wrote:
I want to use multi-thread in pygame game loop,
with main draw and display.update thread,
 event process thread,
game update thread.
and I will use event.post(drawEvent) to tell main thread  to update
screen.
do I need use threading.Lock()  to lock it? or just let it go?
it is too hard to read pygame source code for me.

Posting an event is thread safe, you will not need to worry about locking.

I'm pretty sure you must still get events from the main thread. Getting events is very tied to the platform.