Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Are libexpect functions thread-safe?

Help
woytekm
2010-11-25
2013-05-02
  • woytekm
    woytekm
    2010-11-25

    Hello,
    I'm writing some code using pthreads and expect interpreter library (sequence of Tcl_CreateInterp, Exp_Init, exp_parse_argv, exp_interpret_cmdfilename). Unfortunately, when I create more than one expect interpreter thread, some strange problems appear: segfaults in Tcl_WaitForEvent, Tcl_Init failed: out of stack space (infinite loop?) errors, and other strange program malfunctions suggesting that expect library functions may not be thread-safe… can someone confirm on this ?
    thanks
    WM

     
  • woytekm
    woytekm
    2010-12-03

    ok, just in case someone has a similiar question - i've looked into the libexpect sources, and i've found out that it's not anywhere near being thread-safe, so it's not possible to use its functions in a multithreaded code (at least not "out of the box")…
    WM

     
  • Aiming Xu
    Aiming Xu
    2011-01-18

    fortunately I did'nt try that, although I supposed to do once.
    Now I will never:)