[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] BUG: sprite module is not thread safe.
- To: pygame-users@xxxxxxxx
- Subject: [pygame] BUG: sprite module is not thread safe.
- From: "Rene Dudfield" <renesd@xxxxxxxxx>
- Date: Fri, 2 Jun 2006 16:43:11 +1000
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Fri, 02 Jun 2006 02:43:14 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=jSKk+GwyQutaQxnTlHTyJqjSrShreiw2aHNT4OL9Fw42piHvp3mvsXquE1OL7ILj7pPM4sHlc5PZhcqjRrW1KrEwJgSNDWI65bJcBlrCAp88PD54IKQJkfiIHWuwJ1t2ZRY5wbht/gB5M0Za6iUg2ROVcXO+2s/JuM8oKbg/D7w=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
"""The sprite interface bing written over sdl in python is not thread safe.
If you want multiple threads manipulating sprites in a pygame app you
need to lock the SpriteGroup, while draw()' inig it.
I didn't do any extensive tests, but if i try to kill() a sprite
(remove it from a group) the code will sometimes crash if another
thread is in the process of drawing the group (KeyError: <Sprite
sprite(in 0 groups)>)
"""
I added a note to the docs about the sprite module not being thread
safe. Not that it was intended to be thread safe.