[Stackless] pause execusion of tasklet using remove()
Jimsfba at aol.com
Jimsfba at aol.com
Fri Oct 13 02:02:28 CEST 2006
Hi, I have a situation that 1,000,000 tasklets are making frequent calls to
remote servers and waiting for reply. Each tasket is waiting for its own
reply. These tasklets are also created and removed frequently.
By checking stackless's doc, I know I can create a new channel for each new
tasklet for making blocking call and make itself pause/sleep.
But it looks like creating another model can make the code simpler and I
don't have to create 1,000,000 channel objects.:
1. after sending out request, pause the tasklet by using remove() call
2. use a reply manager to process reply messages and wake up ( tasklet.run()
) the specific tasklet based on taskletID in the reply
3. reply manager kill taskets if they timeout ( I didn't see channel have
build-in timeout setting)
Please let me know I went to the wrong path because of misunderstanding.
When looking at the remove() api, I saw the following warning message about
it:
| remove(...)
| Removing a tasklet from the runnables queue.
| Note: If this tasklet has a non-trivial C stack attached,
| it will be destructed when the containing thread state is destroyed.
| Since this will happen in some unpredictable order, it may cause
unwanted
| side-effects. Therefore it is recommended to either run tasklets to
the
| end or to explicitly kill() them.
Does it mean it's not recommended to use remove() if I am not sure about if
non-trivial C stack has been attached ?
If anyone can explain what is "containing thread" ( for example, is it a
thread generated by stackless internally ? the main watchdog thread or the
calling function of python?) and give an example how remove() might failed, I
will really appreciate.
Thanks in advanced.
- Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20061012/2959048b/attachment.htm>
-------------- next part --------------
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list