[Stackless] Catching exception from tasklets

lars van Gemerden lars at rational-it.com
Sat Jun 23 22:23:27 CEST 2012


Hi Richard,

It was my inexeprience with WingIDE that did it. In the debug window it
says unhandled exception, but in the exception tool it shows that the
exception is caught normally.

Am I correct in concluding that the stackless scheduler is not emptied upon
such an exception?

Cheers, Lars

PS: I will try the code you suggested for emptying the scheduler. I you
like, i'll let you know the result.


On Sat, Jun 23, 2012 at 8:30 PM, Richard Tew <richard.m.tew at gmail.com>wrote:

> On Sat, Jun 23, 2012 at 6:51 PM, Lars van Gemerden <lars at rational-it.com>
> wrote:
> >  Running "mainloop" above (based on the pumping pattern in the
> > documentation) leads to a printout of the exception stack (uncaught in
> the
> > code above). After that at least one tasklet keeps running.
> >
> > Why does this happen?
>
> Why you are getting an exception printed is unclear from the code you
> have provided.  You would need to provide a reproduction case so the
> problem could be observed.  Or at the least, the exception trace given
> it is some Stackless caused problem and not a side-effect of your
> code.
>
> > In a related question, i am trying to define unit tests for my code, and
> > between tests would like to kill/remove/empty the stackless scheduler,
> e.g.
> > in tearDown. What is the easiest way to do this (the exception above
> seems
> > not the way to go ;-) ?
>
> You can empty the scheduler by enumerating the tasklets in the
> scheduler.  This can be done by getting the current tasklet (t =
> stackless.current) and stepping through the chain of scheduled
> tasklets (t.next, t.next.next, t.next.next.next...).
>
> The following code is untested and may not work:
>
>  ct = stackless.current
>  while ct.next is not ct:
>      ct.next.kill()
>
> > I am working (since today) with Wingware as IDE (the only IDE with
> stackless
> > debug support?)
>
> Yes.
>
> Cheers,
> Richard.
>
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless
>



-- 
====================================
Lars van Gemerden
lars at rational-it.com
+31 6 26 88 55 39
====================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20120623/ccc36dfb/attachment.html>


More information about the Stackless mailing list