Limiting thread intruction count

Mark Hammond MarkH at ActiveState.com
Sun Jul 8 01:23:09 EDT 2001


Neil Macneale wrote:

> Is there posibly a function that is called when a thread gives up the
> lock which I could use to take the thread out of the running queue?  


There is no "running queue" as such.  There may simply be a number of 
threads waiting on the global interpreter lock.  You can easily write a 
function in C that releases the lock - thereby allowing any waiting 
threads to start.

Indeed, many existing Python functions do exactly this - time.sleep() 
for example.  It releases the lock, calls the system sleep() function, 
then acquires the lock.

Mark.




More information about the Python-list mailing list