[stackless] "main" tasklet


11-01-2011 10:16:58

I do not use PyOgre directly duo to no support for version 3.1, but this might be the best place to ask this question.

I switched to stackless some time ago and i'm very happy with it. Now one thing has bugged me all the time. I use alternative be_nice scheduling ala eve o. I expect the first py file to be the main tasklet, running as long as the program is active and updating systems. This seems to be not exactly true.

application.py (the main file)

def run(port, node_id):

while True:


That works well, red is a Cpp extension providing Ogre, Opcode, ... and the update function is what you expect it to be. At some random point (while killing a tasklet) i get "RuntimeError: Deadlock: the last runnable tasklet cannot be blocked." So application.run is not considered the main tasklet? But when I create some wrapper like red.run_main(application.run) where red.run_main equals PyStackless_CallMethod_Main the exception "call_main: cant run main from main tasklet whatever ..." is printed.

Long story short: I need a main tasklet to run all the time without _embedding_ stackless. Note that I use the benice scheduling method.

Thanks for any hints.


15-01-2011 14:06:19

Ok, either nobody uses stackless (a shame, it's awesome!) or my description was bad. I want to know how to disable/prevent the Deadlock: the last runnable tasklet cannot be blocked. error. WIth the be_nice scheduling there's no such thing like a deadlock.

Edit: Noob bug. I use channels for sleeping and if a tasklet gets killed, its sleep entry is still there, so the main tasklet was sending without a receiver :shock:


14-03-2011 05:04:56

Can't really help you out here as never used stackless :(