Semaphore question

Jesper Olsen jolsen at mailme.dk
Thu Jan 31 06:49:02 EST 2002


If all you need to share between threads is a list, 
the Queue module is a good choise.

Alternatively you can explicitly set up mutexes to ensure that
only one thread accesses your data at a time:

import thread
lock=thread.allocate_lock()

...

lock.aquire()
#manipulate shared data here
lock.release()

Cheers
Jesper

"MDK" <mdk at mdk.com> wrote in message news:<a39q4u$16cjiu$1 at ID-98166.news.dfncis.de>...

> Could someone give me a clear example of how to use Semaphore so that the
> threads properly acquire and release the Data list?
> 
> Thank you.



More information about the Python-list mailing list