<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.3790.2630" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=071504207-04042006><FONT face=Arial color=#0000ff size=2>I
suspect you could get rid of the uselesstasklet by setting the 'preference'
value</FONT></SPAN></DIV>
<DIV><SPAN class=071504207-04042006><FONT face=Arial color=#0000ff size=2>on
the channel to some value, 0 if I recall</FONT></SPAN><SPAN
class=071504207-04042006><FONT face=Arial color=#0000ff size=2>. But you
might have to read the C</FONT></SPAN></DIV>
<DIV><SPAN class=071504207-04042006><FONT face=Arial color=#0000ff size=2>source
to know for sure.</FONT></SPAN></DIV>
<DIV><SPAN class=071504207-04042006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=071504207-04042006><FONT face=Arial color=#0000ff size=2>If
someone sorts out how it works and sends me a more explanatory
doc</FONT></SPAN></DIV>
<DIV><SPAN class=071504207-04042006><FONT face=Arial color=#0000ff
size=2>string, I can check it in. Same for any of the other doc
strings you may feel</FONT></SPAN></DIV>
<DIV><SPAN class=071504207-04042006><FONT face=Arial color=#0000ff size=2>are
lacking.</FONT></SPAN></DIV>
<DIV><SPAN class=071504207-04042006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=071504207-04042006><FONT face=Arial color=#0000ff size=2>I
don't think you need permission to change anything in the wiki.
I</FONT></SPAN><SPAN class=071504207-04042006><FONT face=Arial color=#0000ff
size=2>f anyone</FONT></SPAN></DIV>
<DIV><SPAN class=071504207-04042006><FONT face=Arial color=#0000ff size=2>wants
any pages added, send me the name and I'll do </FONT></SPAN><SPAN
class=071504207-04042006><FONT face=Arial color=#0000ff size=2>it myself as I
don't</FONT></SPAN></DIV>
<DIV><SPAN class=071504207-04042006><FONT face=Arial color=#0000ff size=2>have
any other solution for that problem.</FONT></SPAN></DIV>
<DIV><SPAN class=071504207-04042006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=071504207-04042006><FONT face=Arial color=#0000ff
size=2>Richard.</FONT></SPAN></DIV>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
stackless-bounces@stackless.com [mailto:stackless-bounces@stackless.com]<B>On
Behalf Of </B>Benjamin Buco<BR><B>Sent:</B> 04 April 2006 01:35<BR><B>To:</B>
stackless@stackless.com<BR><B>Subject:</B> [Stackless]
Queues<BR><BR></FONT></DIV>
<DIV>This is an implementation for what amounts to a queue or buffered
channel. Any suggestions, advice, criticism before I post this to the
wiki would be appreciated. Its probably not the cleanest solution but at
least it's pretty. Also anyone have any objections to me restoring the
link to the channels page to the main stackless page?</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>import stackless</DIV>
<DIV>class Queue(stackless.channel):<BR> def
uselesstasklet(self,value):<BR>
return stackless.channel.send(self, value)<BR> def
send(self, value, wait=False):<BR>
useless =
stackless.tasklet(self.uselesstasklet)(value)<BR>
stackless.schedule(useless)<BR>
return None<BR> </DIV>
<DIV>def testQueue():<BR> print<BR> print
"testQueue"<BR> print
"--------------------"<BR> def recv(ch,
name):<BR> print "Started
recv<%s>" % (name,)<BR> print
"recv<%s>: %r" % (name, ch.receive())</DIV>
<DIV> ch = Queue()</DIV>
<DIV> # Queues are nonblocking on sends when there are no
receivers<BR> ch.send("Primary Entry")<BR>
ch.send("Secondary Entry")</DIV>
<DIV> for name in
"ABCD":<BR> task =
stackless.tasklet(recv)(ch,
name)<BR> task.run()</DIV>
<DIV> ch.send("Third Entry")<BR>
ch.send("Fourth Entry")<BR> print</DIV>
<DIV>testQueue()</DIV>
<DIV> </DIV>
<DIV>Thanks guys.</DIV>
<DIV> </DIV>
<DIV>Benjamin Buco</DIV>
<DIV>MCSE:Security</DIV>
<DIV>IT Instructor</DIV>
<DIV>TechSkills Cincinnati</DIV>
<P>
<HR SIZE=1>
Blab-away for as little as 1¢/min. Make <A
href="http://us.rd.yahoo.com/mail_us/taglines/postman2/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com">PC-to-Phone
Calls</A> using Yahoo! Messenger with Voice.</BLOCKQUOTE></BODY></HTML>