|
From: Sasaki, T. <sas...@jp...> - 2013-02-21 05:33:30
|
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
|