hi,

any help in understanding the program will be highly appreciated.
as per the stackless documentation stackless.run() is must
to start a scheduler. then how come the below program runs
the tasklet "fun" without stackless.run() call?


thanks in advance.


On Fri, Jun 19, 2015 at 2:36 AM, temp sha <[email protected]> wrote:
> Hi,
>
> I could not understand how the below program executes function "fun"
> without calling stackless.run() in the program?  Here "fun" runs as a
> tasklet and as per my knowledge for that stackless.run() is must.
>
>
>
> -----------------------------------------------------------------
> import stackless
>
> class A:
>     def __init__(self,name):
>         self.name = name
>         self.ch = stackless.channel()
>         stackless.tasklet(self.fun)()
>
>     def __call__(self,val):
>         self.ch.send(val)
>
>     def fun(self):
>        while 1:
>          v = self.ch.receive()
>          print "hi" , v
>
>
> if __name__ == "__main__":
>     obj = A("sh")
>     obj(6)
> -----------------------------------------------------------------
>
> output:
> ----------
> hi 6
>
>
>
>
>
> thanks,
> ravi

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

Reply via email to