Btw, “stacklesslib” contains a class, called util.qchannel which has a built-in 
queue.  it would behave just as you expected.
see
http://bitbucket.org/krisvale/stacklesslib

K

From: [email protected] [mailto:[email protected]] 
On Behalf Of Lars van Gemerden
Sent: 24. maí 2013 17:08
To: The Stackless Python Mailing List
Subject: Re: [Stackless] must be something simple

Ok, thank you!
====================================
Lars van Gemerden
[email protected]<mailto:[email protected]>
+31 6 26 88 55 39
====================================

On 24 mei 2013, at 15:15, Kristján Valur Jónsson 
<[email protected]<mailto:[email protected]>> wrote:
Because channels are not queues.  If there is no one waiting to receive, then 
channel.send() blocks.  Channels are “rendezvous points” where one tasklets 
hands over a piece of data to the other.
the “preference” only matters if a transaction can take place.  In this case, 
if a receiver had been blocked on channel, then send would indeed not block.

K

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of lars van Gemerden
Sent: 24. maí 2013 09:36
To: The Stackless Python Mailing List
Subject: Re: [Stackless] must be something simple


Hi,

I must be mssing something basic; why does the following not print anything:

channel = stackless.channel()
channel.preference = 1

def run(a):
    print channel.send(a)
    print channel.receive()

if __name__ == "__main__":

    stackless.tasklet(run)("anything")
    stackless.run()

If with preference  = 1 the send(..) returns immediately, why doesn't "print 
channel.send(a)" print "None" or something and why is 'a' never received?

Cheers, Lars


====================================
Lars van Gemerden
[email protected]<mailto:[email protected]>
+31 6 26 88 55 39
====================================
_______________________________________________
Stackless mailing list
[email protected]<mailto:[email protected]>
http://www.stackless.com/mailman/listinfo/stackless
_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to