Python threads question

Aahz Maruch aahz at netcom.com
Sun Aug 20 15:53:09 EDT 2000


In article <8npbok$al5$1 at news7.svr.pol.co.uk>,
Makhno <mak at imakhno.freeserve.co.uk> wrote:
>
>Deadlocking would be a worry though with all this blocking and reaquiring
>going on.

I don't think that's an issue, but you should confirm with someone who's
actually written thread-safe extensions.

>Can I ask how the switching is achieved? Presumably a thread just counts
>upto 10 bytecodes then releases its lock, and immediately tries to require
>it.

I believe that's correct, but I'm not certain of the internals.

One other thing: a good way to force a thread to "give up" its lock is
to call time.sleep(0.01).
--
                      --- Aahz (Copyright 2000 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"A foolish consistency is the hobgoblin of little minds, adored by little 
statesmen and philosophers and divines."  -- Ralph Waldo Emerson



More information about the Python-list mailing list