thread, threading, mutex modules and non-threading interpreters

Niels Diepeveen niels at endea.demon.nl
Fri Aug 25 13:16:00 EDT 2000


Tripp Lilley schreef:

> The mutex module says that it doesn't depend on threads, but thread and
> threading say nothing about how they behave under a non-threading
> interpreter.

They are simply not there, so you could do something like this:

try:
    from threading import Lock
except ImportError:
    class Lock:
        def acquire(self, blocking=1):
            if not blocking:
                return 1
        def release(self): pass

-- 
Niels Diepeveen
Endea automatisering




More information about the Python-list mailing list