[Stackless] Question about Channel Queue attribute

Kristján Valur Jónsson kristjan at ccpgames.com
Sun Dec 6 22:20:07 CET 2009


There is no "correct" behaviour, since this isn't defined by some specification somewhere.
In C stackless, tasklets are linked together using their "next" attribute.  This is used to implement the runnable queue and also the queue for the tasklets.  The channel's "queue" slot simply holds a reference to the first tasklet in the queue.

To get all the tasklets, use this:
def GetQueue(channel):
	first = task = channel.queue
	result = []
	while task:
		result.append(task)
		task = task.next
		if task is first: break
	return result


I expect that the channels are differently implemented in PyPy, perhaps using a Deque, so that is what queue returns for that implementation.
K

> -----Original Message-----
> From: stackless-bounces at stackless.com [mailto:stackless-
> bounces at stackless.com] On Behalf Of Andrew Francis
> Sent: 6. desember 2009 19:47
> To: stackless at stackless.com
> Subject: [Stackless] Question about Channel Queue attribute
> 
> Hi Folks:
> 
> I am using python 2.5.2 on Ubuntu 9.04...
> 
> I noticed that channel.queue returns the head of the queue rather than
> the queue. I also looked at channel_get_queue() in channelObject.c. I
> have to admit, my C is a bit rusty but it looks like it returns the
> first object in the queue.
> 
> In contrast, when I use Stackless.py, I get back a dequeue (this is the
> way it is implemented) which is what I would expect.
> 
> What is the correct behaviour?
> 
> Cheers,
> Andrew
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless





More information about the Stackless mailing list