RE: [tcljava-dev] Latest 1.3.0 build and INterp.evalFile()
Brought to you by:
mdejong
From: W. J. G. <gu...@ea...> - 2001-03-26 16:44:58
|
> -----Original Message----- > From: tcl...@li... > [mailto:tcl...@li...]On Behalf Of Mo DeJong > Sent: Friday, March 23, 2001 1:36 AM > To: tcl...@li... > Subject: RE: [tcljava-dev] Latest 1.3.0 build and INterp.evalFile() > > > On Wed, 21 Mar 2001, W. John Guineau wrote: > > > Hi Mo, > > > > You mentioned previously on this (or another) list that there were some > > problems remaining in 1.3.0 to do with termination? > > Yeah, I think our multi-threaded startup stuff is ok. > It is the shutdown that seems to have problems. Yes, I can run multiple interps fine, but stopping/destroying them does not seem to be working. > > > Would that be the assert I'm seeing in the TclBlend.DLL at: > > > > src/native/javaCmd.c: > > > > TCLBLEND_EXTERN JNIEnv *JavaGetEnv() > > { > > ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); > > assert(tsdPtr->initialized); > > return tsdPtr->currentEnv; > > } > > > > > > It seems to happen when calling Interp.destroy(). > > Humm, that says to me that the JavaGetEnv() method is getting > called after the thread has been cleaned up. Could you provide > a nice little test case for this problem? I'll try. Right now, my 'test case' is sitting in about 130K lines of code ;) Basically what I'm doing is this: - Create a thread "N" to run "notifier.doOneEvent()" in a while( _run ){} loop (i.e. if _run == false, the notifier thread will exit.) - From another thread "E", feed the notifier an event to eval() a String full of Tcl. - When E completes (that is, the interp.eval() completes) it: - sets _run to false to let N exit. - feeds N an empty string to eval() so doOneEvent() will emerge. - join()'s N (waits for N to exit) - E then does an interp.destroy() and I get the assert. Am I shutting down the interp/notifier correctly? > If you really want > to lend a hand, designing some test cases that will check > the startup and shutdown cases would really help. They > are tricky because they are not like any of the other tests. > Startup and shutdown tests might need to be run as separate > programs before running the normal "make check" rule. And take the fun away from you? ;) > > Also - if I have a notifier thread sitting in > notifier.doOneEvent(), what's > > the recomended way to get it out? Right now, I just send it an > empty string > > to eval() and that causes the notifier.doOneEvent() while() loop to exit > > (taking the thread with it). > > Do you mean you want to make another thread exit from one that > you are in? I think you would to use the Thread package for > that. I think you send a thread::exit command to your target > thread using the thread::send command. My memory is a little > fuzzy in this area so I could be way off. > > http://dev.scriptics.com/ftp/thread//thread21.html I meant the Java thread(s) running the TclBlend Interp and it's Notifier. See above for a (hopefully lucid) description of what I mean. > > Mo DeJong > Red Hat Inc > john |