[C++-SIG] Re: [Thread-SIG] Controlling python execution from C
Marcelo Kallmann
kallmann at lig.di.epfl.ch
Wed Nov 17 13:56:13 CET 1999
> The Python interpreter runs to completion. It will not "unwind" and return
> to your loop.
>
> It uses *real* threads, and blocks on one to cause a context switch to
> another ready-thread.
>
> Well... more specifically, one thread grabs the global lock. Periodically,
> it releases it and re-acquires it. In that short time-frame when it
> doesn't hold the lock, another thread can wake up, grab it, and begin
> execution for a while.
Thank you for the info.
So, I would be able to do something like :
char *scripts[N]; // my n scripts
for ( i=0; i<n; i++ )
{ start_and_interpret_in_new_thread ( scripts[i] );
}
So, can someone explain me how to write such a function
start_and_interpret_in_new_thread (s) ?
Some example code would be apreciated .
Thank you,
Marcelo K.
EPFL - DI - LIG
More information about the Cplusplus-sig
mailing list