Ticket UUID: | 159a3e1dab1142775a8e1ccee3e09323d9e290de | |||
Title: | Creating Tcl_Interp from two different threads ends up in an infinite loop | |||
Type: | Bug | Version: | 8.6.5 | |
Submitter: | jpo38 | Created on: | 2016-05-03 06:27:30 | |
Subsystem: | 49. Threading | Assigned To: | nobody | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Closed | Last Modified: | 2016-06-07 06:37:38 | |
Resolution: | Invalid | Closed By: | oehhar | |
Closed on: | 2016-06-07 06:37:38 | |||
Description: |
I'm embedding Tcl interpreter library (8.6.5) in a C++ application. I can't create two interpreters from two different threads. The following code ends up in an infinite loop: void runScript()
{
Tcl_Interp* pInterp = Tcl_CreateInterp();
Tcl_DeleteInterp( pInterp );
}
int main( int argc, char* argv[] )
{
Tcl_FindExecutable(NULL);
Inifinite loop occures here:
Adding:
within the loop apparently fixes the issue. Note that I compiled Tcl with a CMake script, I noticed that TCL_THREADS is not set (not sure it's related or not) | |||
User Comments: |
jpo38 added on 2016-06-06 19:27:43:
@dgp:TCL_THREADS was disabled because I compiled on windows using a CMake Lists.txt file I found on the web: this one was actually written for Linux and disabled thread support because it was unable to find pthread on my machine. I finally compiled Tcl libraries using the scripts provided threading is enabled by default and the infinite loop is gone! Thanks for your help! dgp added on 2016-05-17 14:00:58: I don't understand what you are asking. I build only with the unix subdirectory toolchain. In that build system, the --enable-threads option to configure causes Tcl to be built supporting multi-threaded operations under the "apartment model". This is the default setting in releases Tcl 8.6.0 and higher. jpo38 added on 2016-05-14 08:31:42: @dgp Can you point me to the doc explaining how to do that? Especially where to find compatible pthread version and have it be found by build system? dgp added on 2016-05-03 12:56:24: TCL_THREADS=1 is the means by which Tcl is compiled to support multi-threaded use. From what you've posted, I strongly suspect that's the problem here. If you continue to have trouble with a --enable-threads build of Tcl, please post again. |