[EMAIL PROTECTED] wrote:
Hi experts-
I have a potential use case of embedding Python where it must co-
operate with the host c/c++ application in a single thread. That is,
the c code and python interpreter need to cooperate and time share, or
yield to each other.
The main loop would need to do something like:
check for events
for events with c handlers:
process in c
for events with python handlers:
add to queue
if have time:
python_continue_execution(number of vm instructions)
The goal is to be able to set some limit on the amount of time in the
interpreter in each loop, and not rely on the python side code. (I
realise this will not be absolute, especially if the python code calls
c extensions, but it will be more straight forward for the users.)
Does anyone have any suggestions for how this could be achieved?
Does this help at all?
>>> help(sys.setcheckinterval)
Help on built-in function setcheckinterval in module sys:
setcheckinterval(...)
setcheckinterval(n)
Tell the Python interpreter to check for asynchronous events every
n instructions. This also affects how often thread switches occur.
I *don't* know any more that this.
tjr
--
http://mail.python.org/mailman/listinfo/python-list