[Stackless] Problems with Queues in Microthread Lib.

Gordon McMillan gmcm at hypernet.com
Fri Mar 16 16:18:56 CET 2001


> Hi all,

Hint: for each "request_queue.put(None)" you add to your 
script, you'll get a "But not here..." message.

In effect, Queue works by making your worker threads 
disappear (as runnable tasks) if they don't have anything to 
do. So you fall out of uthread.run(), because no one has 
anything to do.
 
> For some strange reason I can\'t figure out to make
> queues work correctly for me.  This is the code I\'m
> testing with:
> 
> --- start code ---
> import uthread
> 
> #CONSTANTS
> THREAD_NUM = 2
> 
> def worker_function(mqueue):
>         print "Somehow I get here..."
>         mqueue.get()
>         print "But not here..."
> 
> request_queue = uthread.Queue()
> for i in range(0,THREAD_NUM):
>     uthread.new(worker_function,request_queue)
> uthread.run()
> --- end code ---
> 
> The output, as you might imagine from the frustrated
> source, is:
> 
> bash# python test.py 
> Somehow I get here...
> Somehow I get here...
> bash#  
> 
> Ack!  I thought at first that get() was just not 
> blocking for me, but now it appears that it\'s quitting
> the microthread entirely for some reason!  
> 
> If it\'s any help at all, mqueue.cget() will read None
> and the microthread will carry out its normal lifespan.
> 
> Here\'s my arrangement:
> 
> i386 FreeBSD 4.2
> Python 2.0c1
> Stackless from TODAY!  It\'s fresh...
> 
> Thanks in advance,
> 
> James Turner
> _______________________________________________
> Stackless mailing list
> Stackless at starship.python.net
> http://starship.python.net/mailman/listinfo/stackless



- Gordon
_______________________________________________
Stackless mailing list
Stackless at starship.python.net
http://starship.python.net/mailman/listinfo/stackless



More information about the Stackless mailing list