From: Sasaki, T. <sas...@jp...> - 2013-02-26 01:41:03
|
Dear Jeff, Thank you for responding. I don't make sure to compile more large. The message "out of stack space (infinite loop?)" was printed by the interpreter in tclsh. To make more large stack space is option of "configure" command ? That issue happens inside tclsh8.5. That error message is created by Tcl_Eval in an interpreter in tclsh8.5, below. int proc_run(ClientData cd, Tcl_Interp *interp, int argc, const char *argv[]) { if( Tcl_Eval(g_interp, (std::string("run")+" "+argv[1]).c_str()) == TCL_ERROR ) { std::cerr << Tcl_GetStringResult(g_interp) << std::endl; exit(1) ; } <===[HERE] pthread_mutex_unlock(&g_mutex); pthread_mutex_lock(&g_mutex); return TCL_OK; } g_interp is an interpreter in tclsh. In Tcl_Eval(g_interp, "run 0") or Tcl_Eval(g_iterp, "run 1"), issue happened. About tclsh8.4, even if libsample.so links either libtcl8.4.so or libtcl8.5.so, programs runs correctly. About tclsh8.5, even if libsample.so links either libtcl8.4.so or libtcl8.5.so, the program doesn't run. If this line is omitted and printf is added, even about tcl8.5, it runs. Software architecture is different, between 8.4 and 8.5 ??? # I would like tclsh to be replaced by 3rd-party tools, in actual use... I don't understand what's happen. Takayuki, SASAKI |-----Original Message----- |From: Jeff Hobbs [mailto:je...@ac...] |Sent: Tuesday, February 26, 2013 8:59 AM |To: Sasaki, Takayuki/佐々木 貴行 |Cc: tcl...@li... |Subject: Re: [Tcl-Threads] query about TCL 8.5 C API behavior in using pThread | |Are you making sure to compile with larger stack space for each thread? There |is a setting either in the compiler or even sometimes at runtime. It may just |be that we are using more stack space that effects the app, but can be modified |by compile time thread stack enlargement. | |Jeff | |On Wed, Feb 20, 2013 at 9:33 PM, Sasaki, Takayuki <sas...@jp...> |wrote: |> Dear Sirs/Madams, |> |> |> I'm TCL C API user and have trouble. |> |> |> Since I would like to have asked about TCL API C, I sent this mail. |> I have a question about difference between Tcl 8.4 and Tcl 8.5. |> When I made Tcl-Interpreters run on PThread using Tcl 8.4, this was |> good but when I made Tcl-Interpreters run using Tcl 8.5, this wasn't good. |> Executable code prints "out of stack space (infinite loop?)". |> I can't guess causes. I'm wondering if you could tell me solution. |> |> |> I write details using sample program. |> Attached file "sample.tgz" has following files. |> |> sample.cpp : source file |> base.tcl : tcl script for tclsh |> chile0.tcl : tcl script called by base.tcl. (for thread 0) |> chile1.tcl : tcl script called by base.tcl. (for thread 1) |> Makefile : makefile |> make.sh : shell script for make |> run.*.sh : shell script for execution |> *.log : log file |> |> |> I would like interpreters to run on tclsh. |> For example, if there is following description, I would like child0.tcl and |child1.tcl to be interpreted in child threads. |> load ./libsample.8.5.so |> sample child0.tcl child1.tcl |> I would like "run" command in child0.tcl or child1.tcl to be sent to tclsh. |> |> |> Source code is "sample.cpp". In sample.cpp, |> 1) Command "sample" add to interpreter of Tclsh, at function "Sample_Init". |> 2) Arguments of command "sample" are file names. Function for "sample" is |"proc_sample". |> In this function, threads are made for each file name, and threads are |joined. |> "interp_thread" is thread function, and this argument is file name. |> 3) The first of "iterp_thread" is "mutex_lock" and the last is |"mutex_unlock". Inside, |> a) Tcl_CreateInterp |> b) Tcl_Init |> c) Tcl_CreateCommand |> d) Tcl_FileEval |> At c), I add "run" to each Tcl interpreter on PThread. Function of "run" |is "proc_run". |> 4) At "proc_run", Tcl_Eval is called for tclsh. and then |"pthread_mutex_lock", "pthred_mutex_unlock" are called. |> |> |> I executed "do.sh". |> executable code using Tcl 8.4 was correct, but executable code using |> Tcl 8.5 wasn't correct. |> Executable code using 8.4 printed following messages. |> |> base: run 1 |> base: run 1 |> base: run 1 |> base: run 1 |> base: run 0 |> base: run 0 |> base: run 0 |> base: run 0 |> |> Executable code using 8.5 printed following messages. |> |> out of stack space (infinite loop?) |> |> |> I don't know what's happened. Excuse me, I would like to fix source code. |> Could you please tell me solution ? |> |> Thank you for reading to the last. |> Takayuki, SASAKI |> |> |> |> |> ---------------------------------------------------------------------- |> -------- Everyone hates slow websites. So do we. |> Make your web apps faster with AppDynamics Download AppDynamics Lite |> for free today: |> http://p.sf.net/sfu/appdyn_d2d_feb |> _______________________________________________ |> Tcl-Threads mailing list |> Tcl...@li... |> https://lists.sourceforge.net/lists/listinfo/tcl-threads |> |