This looks like a continuation.  But what's more, you are combining two things 
into one:
1) the schedule call and
2) when woken up, you want to discard the stack and softswitch into some 
toplevel call.

I don't understand the reason for 2.  Why not simply "return" up whatever 
callstack placed you in this position in the first place?
Also, 2 is not safe.  You might be discarding python state essential to the 
tasklet.  It is only possible to discard a c stack in a select few places in 
stackless.  Look for "stackless_schedule_return()" in the source code.

Don't be afraid of c stack switching.  It is really fast.

K

> -----Original Message-----
> From: [email protected] [mailto:stackless-
> [email protected]] On Behalf Of Péter Szabó
> Sent: 27. janúar 2010 17:14
> To: The Stackless Python Mailing List
> Subject: Re: [Stackless] Stackless and Pyrex efficiently
> 
> > If you are doing tasklet switching from C, there is no avoiding the
> hard switching.
> 
> Thanks for this information. I'd be happy with a custom hack like this:
> 
> def Wake(self):    # defined in Python (or C)
>   print 'Wake'
>   ...
> 
> void MyCFunction() {
>   // This will discard the bottommost C stack, and it will call Wake
> as soon as the tasklet is rescheduled.
>   PyStackless_ScheduleAndContinueWith(None, 1, Wake)
> }
> 
> _______________________________________________
> Stackless mailing list
> [email protected]
> http://www.stackless.com/mailman/listinfo/stackless


_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to