[Stackless] Stackless API (Custom Scheduling)

Eggert Jón Magnússon ejm at gavia.is
Fri Jan 30 11:08:58 CET 2004

The thing with exception passing, that annoys me a bit, is that I am unable
to send an exception object through a channel without automagically raising
it on the receiver.
That's terribly inconvenient, since it excludes exceptions from the possible
objects to send through channels.

I think exceptions should only be raised if send_exception is called - but
sent normally if send() is called.
It remains a useful feature to have - but should perhaps not be part of the
main channel functionality, but rather a sub-class - since most of it can be
implemented on top of a normal channel.  Tismer's concern is, rightfully so,
that this feature makes channels, which are stackless's low level primitives
(along with tasklets), slightly more complicated, which results in
harder-to-maintain code.

I don't know though - a feature of stackless that kills a cat sounds a bit
of an overkill to me. :)

-----Original Message-----
From: stackless-bounces at stackless.com
[mailto:stackless-bounces at stackless.com]On Behalf Of Kristján V. Jónsson
Sent: 30. janúar 2004 09:14
To: stackless at stackless.com
Subject: RE: [Stackless] Stackless API (Custom Scheduling)

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

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list