[Stackless] Calling stackless.run() from C code

Nelsen, Patrick Patrick.Nelsen at spectrumdsi.com
Sun May 10 03:27:09 CEST 2009


Hi all,

Currently I'm working on a stackless python 2.6.2 implementation on a single threaded embedded device.  The application running inserts and removes tasklets asynchronously based on hardware callbacks.  I am trying to write a scheduling loop in C that will reinsert tasklets to the run queue and call stackless.run(100).  The problem that I am running into is that _Py_Ticker value never gets reset. This causes every single call to stackless.run(100) after the first call will hit the stackless_interupt_call in ceval.c line 2995, and no more code gets executed.  My scheduling routine is attached in the file my_scheduler.c in the method scheduler_run().  I have been using the test_scheduler.py script to test my module.  I also wrote a test script called test_stackless that mimics the behavior that I'm trying to accomplish.  In addition, I also verified that I got the same result when I moved the test() method to its own module.  I am missing a step in setting up the call to stackless.schedule() in my c code?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LinkedList.h
Type: text/x-chdr
Size: 314 bytes
Desc: LinkedList.h
URL: <http://www.stackless.com/pipermail/stackless/attachments/20090509/528e429b/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: my_scheduler.c
Type: text/x-csrc
Size: 3620 bytes
Desc: my_scheduler.c
URL: <http://www.stackless.com/pipermail/stackless/attachments/20090509/528e429b/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_scheduler.py
Type: text/x-python
Size: 176 bytes
Desc: test_scheduler.py
URL: <http://www.stackless.com/pipermail/stackless/attachments/20090509/528e429b/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_stackless.py
Type: text/x-python
Size: 219 bytes
Desc: test_stackless.py
URL: <http://www.stackless.com/pipermail/stackless/attachments/20090509/528e429b/attachment-0001.py>


More information about the Stackless mailing list