Own implementation of multithread
- From: lkfstephen@xxxxxxxxx
- Date: Wed, 27 Aug 2008 15:15:47 -0700 (PDT)
Dear all,
I am working on a multithread application.
I have already built the TCL using --enable-threads.
In c++ code, I am trying to create many threads, each thread will
create its own interpreter.
Each interpreter will need to eval a script.
For example,
void * func( void * null ){
Tcl_Interp* tcl_interp = Tcl_CreateInterp();
Tcl_Init(tcl_interp);
char * script = "set a 1\n"
"set b 2\n"
"puts $a\n"
"puts $b\n";
Tcl_EvalObjEx(tcl_interp, script , TCL_EVAL_GLOBAL);
delete tcl_interp;
}
int main (){
....
for (int i = 0; i < 10000; ++i)
pthread_create(&tid,NULL,func,NULL);
....
}
I would like to ask is this approach is wrong?
Stephen Lai
.
- Follow-Ups:
- Re: Own implementation of multithread
- From: Donald Arseneau
- Re: Own implementation of multithread
- From: GPS
- Re: Own implementation of multithread
- From: Ron Fox
- Re: Own implementation of multithread
- From: Alexandre Ferrieux
- Re: Own implementation of multithread
- Prev by Date: panedwindow widget crash issue
- Next by Date: Re: question about reset counter/data
- Previous by thread: panedwindow widget crash issue
- Next by thread: Re: Own implementation of multithread
- Index(es):
Relevant Pages
|