For Programmers: Free Programming Magazines  


Home > Archive > Tcl > April 2007 > Re: Snack, play sound: script behavior in C++ program diifers from









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Snack, play sound: script behavior in C++ program diifers from
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


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com