[Stackless] added tasklet.throw

Anselm Kruis a.kruis at science-computing.de
Tue Apr 9 10:55:26 CEST 2013


Am 08.04.2013 23:02, schrieb Richard Tew:
> Is there any value in passing in the tasklet the exception happened
> in, as the first argument of the error handler?

I think so.

> If every thread has a scheduler, should the error handler be stored in
> the thread context?

Nice to have, but not strictly necessary, if you pass in the tasklet. 
One could write a "dispatching error handler" that uses 
tasklet.thread_id to delegate to a thread specific handler.

I have a use case with several threads that run completely independent 
from each other. Here I could use a per thread error handler.


> On Tue, Apr 9, 2013 at 6:02 AM, Kristján Valur Jónsson
> <kristjan at ccpgames.com> wrote:
>> Done, check it out in the repo.
>> This is currently indirectly possible, by setting stackless.tasklettype
>> (IIRC) wehre you can put a tasklet subclass that overrides the __new__ etc.
>> But the problem with both approaches is that an exception delivered before
>> the tasklet has had the chance to run for the first time won't be handled by
>> this.  Hence my suggestion to set a global handler.  Having a module level
>> handler is fine, IMO.  Adding such a beast is also simple to do.  Perhaps
>> I'll make the experiment.
>> Sounds fine to me, also.
>> Cheers,
>> Richard.
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless

  Dipl. Phys. Anselm Kruis                       science + computing ag
  Senior Solution Architect                      Ingolstädter Str. 22
  email A.Kruis at science-computing.de             80807 München, Germany
  phone +49 89 356386 874  fax 737               www.science-computing.de
Vorstandsvorsitzender/Chairman of the board of management:
Gerd-Lothar Leonhart
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Michael Heinrichs, 
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Philippe Miltin
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196

More information about the Stackless mailing list