[Stackless] Stackless API (Custom Scheduling)

Kristján V. Jónsson kristjan at ccpgames.com
Fri Jan 30 10:14:17 CET 2004

Actually I think this is one of the cooler features of stackless, that exceptions can be passed over channels like this.  I didn't' think of this as a kill feature, more of an error handling mechanism.  

Think of a tasklet, blocking to receive data from a worker tasklet.  Now the worker hits a division by zero and has no data to send.  How do you alert the listener?  Why, you send him the exception.
This would have to be handled manually, of course, from an exception handler in the tasklet.

CCP uses this heavily in its networking code.  We use asynchronous sockets to avoid blocking the process, blocking is done on the tasklet level.  If a socket error occurs, an exception is passed to the blocked tasklet.  This is very useful.  If this were to be taken away, we would have to manually send the exceptions over, by wrapping up the exception and sending it over the channel.  Is this possible()?

  But continuing the discussion of tasklet.join(), it could be done automatically also.  A tasklet that causes an exception that isn't handled, can wrap it up and store as the tasklet result.  When someone calls join(), that exception is passed on.

Hmm, how would that work when multiple joins are done?  Perhaps multiple joins are a bad idea anyway.

And what about uncaught exceptions in tasklets that don't ever get join()?  Perhaps the "detached" tasklet idea is useful after all.

-----Original Message-----
From: stackless-bounces at stackless.com [mailto:stackless-bounces at stackless.com] On Behalf Of Christian Tismer
Sent: 29. janúar 2004 19:57
To: Hilmar V. Pétursson
Cc: Bob Ippolito; stackless at stackless.com
Subject: Re: [Stackless] Stackless API (Custom Scheduling)

As we are at it:
What I *want* to take out is support for sending
exceptions to channels.
This was an early approach to kill somthing that's
waiting in a channel. I think this is no longer needed,
and it would clarify the code quite some bit.
Today, we have an explicit kill that can kill any
tasklet and even a cat. In summer 2002, I couldn't do that.

cheers - chris

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list