OS Plafform:and Version:
SunOS wapgw1 5.8 Generic_117350-22 sun4u sparc SUNW,
Brief Description about behavior:
I have a multithread program in unix c++ . In one
thread, I create a TCl Interpreter with
Tcl_CreateInterp and execute the script buffer.
In some other threads I do some other things.
Currently, I migrate my program from my solaris 8
to another solaris 8,
it often core dump abnormally if I keep on execute the
following two tcl sencenses.
set systemTime [clock seconds];
set TclVarTimeStamp [clock format $systemTime -format %
I check the source code and find that there are many
functions related to time or time zone which call
not localtime_r(). Although I find many mutex lock in
these functions, but it can only assure that all the
threads can safely call this type of function, not
For example: a two thread app
Thread1: TCLInterpreter call localtime with mutex
Thread2: some times call localtime_r
then, no matter how the thread1’s tcl source code
lock the localtime() operation, thread2 can also
access the localtime_r()
since the tcl’s mutex lock have nothing to do with
thread2, it only take effect in tcl8.3.2 source code.
And when thread1 and thread2
call this function at the same time, it will be
So, I wonder whether the tcl8.3.2 related time
operation is thread-safe and how to make it thread-
safe. In the lasted version tcl8.4.12,
I still find many place which call localtime() instead
One more puzzling thing which I can’t figure out and
My program was build in the Solaris OS whose system
TIMEZONE is PRC, while the Solaris OS which make my
is not PRC but others like Hongkong, etc. If I set the
TZ environment in the unix login shell and run my
program in the “core” OS, it runing fine.
Why??? anyone met this before and how to fix it?
Personly, I think the tcl’s time operation is unsafe:
( Does it a known bug?