[Stackless] Basic stackless embedding
amacentire at ymail.com
Wed Jan 19 01:49:14 CET 2011
Hello and thank you for your answer.That is what I thought after noticing the 0 runcount when called from the C API against the 1 runcount result from the called interpreter.Your answer clarifies what happens.
The only question I still have if it's desirable for the PyStackless_GetCurrent() to crash when there are not running tasklets.I don't know if there is any sane scenario in which it gets called while there are no running tasklets, but then again my experience lacks.
--- On Wed, 19/1/11, Richard Tew <richard.m.tew at gmail.com> wrote:
From: Richard Tew <richard.m.tew at gmail.com>
Subject: Re: [Stackless] Basic stackless embedding
To: "The Stackless Python Mailing List" <stackless at stackless.com>
Date: Wednesday, 19 January, 2011, 1:41 AM
On Wed, Jan 19, 2011 at 12:30 AM, Andrew Macentire <amacentire at ymail.com> wrote:
> I am replying to my own thread.
> Doing a PyStackless_GetRunCount() shows that 0 tasklets are running and that explains why the st.current is in that state.However, I'm not sure crashing the whole application is the best way for PyStackless_GetCurrent() to behave.
> Also, what contributed to my confusion was that from the PyRun_Simplestring("print stackless.getcurrent()") the return value was 1.I guess I will look further today to see why exactly that is so.
When you execute "getcurrent" in Python, the Python interpreter is
running and a current tasklet is created as part of the process of it
doing so (this is actually the same as the main tasklet). When you do
it from C, the Python interpreter is not running and there is none.
This is correct behaviour.
Stackless mailing list
Stackless at stackless.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Stackless