Menu

#4946 Tcl_CreateInterp() hangs

obsolete: 8.5.10
closed
None
8
2011-10-26
2011-10-23
realmojo
No

Dear all,

I try to integrate tcl interpreter into my C++ program, but when I
call Tcl_CreateInterp() 3rd times in a new thread, it hangs. This
problem only occurs in tcl85.dll. when I change to tcl83.dll, this
problem disappeared. Here is my code. Thank you for help

#include <afxwin.h>
#include "tcl.h"
#include <iostream>
#include <process.h>

using namespace std;

DWORD WINAPI TclThread(LPVOID)
{
Tcl_Interp *interp = Tcl_CreateInterp();
cout << " exit TclThread " << endl;
return 0;
}

int main(int argc, char *argv[])
{
for (int i = 0; i < 3; i++)
{
unsigned long p;
CreateThread(NULL, 0, TclThread, NULL, 0, &p);
Sleep(2000);
}

system("pause");
}

Discussion

  • realmojo

    realmojo - 2011-10-23
    • milestone: --> obsolete: 8.5.10
    • priority: 5 --> 8
     
  • realmojo

    realmojo - 2011-10-24
    • assigned_to: nobody --> dgp
     
  • Don Porter

    Don Porter - 2011-10-25

    Don't know why my comment yesterday didn't appear..

     
  • Don Porter

    Don Porter - 2011-10-25

    Confirm that your Tcl library was built
    with --enable-threads.

    Use [tcl::pkgconfig get threaded] to test.

     
  • realmojo

    realmojo - 2011-10-26

    Thanks dgp. It works now

     
  • realmojo

    realmojo - 2011-10-26
    • status: open --> closed