Re: [Tcl-Threads] Ttrace
by Kim Chuan Lim other posts by this author
Jun 10 2005 9:18AM messages near this date
[Tcl-Threads] Tcl/Tk 2005 Second Call for papers
|
[Tcl-Threads] Ttrace
Hi Kevin,
Sorry for my stupid question. I have rewrite the test program.
The following is my test program.
##################################################
package require Thread
package require Ttrace
set tid_0 [thread::create -preserved]
ttrace::eval {
proc foo {} {
puts foo
}
proc bar {} {
puts bar
}
}
set func_1 {
foo
}
thread::send -async $tid_0 $func_1
##########################################
Error:
~~~~~
$ tclsh wiki.tcl
Error from thread tid0x41454bb0
can't find package Ttrace
while executing
"package require Ttrace"
Error from thread tid0x41454bb0
invalid command name "foo"
while executing
"foo"
====================================
May i know how come the created thread is not able to execute the function foo?
Can i have a short/simple example how to use ttrace?
Best Regards,
Kim Chuan.
On 6/10/05, Kevin Kenny <kennykb@[...].com> wrote:
>
> lim.kim.chuan@[...].com said:
> > package require Thread
> > package require Ttrace
> > for {set i 0} {$i < 4} {incr i} {
> > set tid($i) [thread::create -preserved]
> > bar
> > }
> > ttrace::eval {
> > proc foo {} {
> > puts foo
> > }
> > proc bar {} {
> > puts bar
> > }
> > }
>
> Your problem is not with Ttrace, but with understanding Tcl at a
> much more fundamental level. Tcl is not a compiled language - it
> evaluates the commands in its scripts in the order in which they
> appear.
>
> In your case, you are creating threads and calling [bar] in the
> [for] loop at the head of the script, before you have defined
> the [bar] procedure (in the ttrace::eval}.
> --
> 73 de ke9tv/2, Kevin KENNY GE Corporate Research & Development
> kennykb@[...].com P. O. Box 8, Bldg. K-1, Rm. 5B36A
> Schenectady, New York 12301-0008 USA
>
>
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
_______________________________________________
Tcl-Threads mailing list
Tcl-Threads@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-threads
|