| David Gravereaux 2007-04-26, 7:08 pm |
| skulinetz@excite.donbass.com wrote:
> unsigned __stdcall run_script (void * data)
> {
> cout << "thread started" << endl;
>
> tcl_info * info = static_cast <tcl_info *> (data);
> int r = eval (info->i, info->script);
>
> cout << "thread finished, exit code: " << r << endl;
> return r;
> }
info->i came from your main thread. You can't call interp functions [such as
Tcl_Eval] from a thread that isn't the one that created it.
http://www.tcl.tk/doc/howto/thread_model.html
You either need a new Tcl_Interp* or operate all of Tcl inside that thread alone.
A Tcl_Interp* is Tcl's state of execution. It can not be modified in parallel.
A thread can have many interps, but an interp can only have one thread.
See the message "vwait doesn't return after setting Tcl_SetVar from a thread" from
yesterday for a possible solution.
--
"If we wanted more leisure, we'd invent machines that do things less
efficiently." -Calvin's dad
|