Limiting thread intruction count

Mark Hammond MarkH at ActiveState.com
Sun Jul 8 07:23:09 CEST 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