[CentralOH] Fwd: Re: Stackless Python

Neil Ludban nludban at osc.edu
Wed Nov 4 21:29:26 CET 2009

On Nov 4, 2009, at 2:50 PM, Brian Costlow wrote:
> Bryan,
> Didn't see any public responses to your post of your code, wondered  
> if you got any private help?
> You do need to add your lock around your 'done' print statement. The  
> GIL is removed for I/O and without the lock, these intermix with the  
> worker threads' print statements.

OK, try *removing* the with-lock and the print and replace it with
something like this:
	s = '%i %f\n' % (me, dividend)
	os.write(1, s)

The problem being that all threads were blocking on the one lock waiting
for slow terminal output to complete.  Making direct system calls with
the complete string should serialize output and keep threads moving.

More information about the CentralOH mailing list