I haven't gone much past tracking where JAVA_LOCK is in the code, and a
cursory glance on what it's doing.

With the Java <-> Tcl Queue, I don't see any reason to artificially tie up
the JNI layer with more locking - only where appropriate within the JNI/C
code itself.

However! The one place you DO need locking is in the [Interp] callbacks.
Concider that Interp is calling into pure Java code, with access to pretty
much everything any other code running in that JVM does. If that "callback"
accesses any data shared in the *Java* environment (with other Java threads
etc) then there needs to be protection there.

What I do in our other Java <-> JNI interface is to provide a shared Mutex
(created in WIN32) that a JNI (callback) thread must aquire before making a
callback. Likewise, the Java side code must respect the mutex for access to
any shared data/objects etc.

I haven't gotten that deep into Tcl Blend yet, so I don't know what it does
in this regard.

john


> -----Original Message-----
> From: Mo DeJong [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 29, 2000 6:29 PM
> To: W. John Guineau
> Cc: [EMAIL PROTECTED]
> Subject: [Tcl Java] RE: [Tcl Java] RE: [Tcl Java] Re: [Tcl Java] problem
> with creating Interp object
>
>
> On Mon, 29 May 2000, W. John Guineau wrote:
>
> > Mo,
> >
> > Since it's in my best interest, I can probably help with:
> >
> > 4. Merge the rest of Mr. Wu's patches for Tcl Blend.
> >
> > Is there a simple way for me to access the online CVS repository from
> > Windows? I do have a dual-boot system with Linux (RedHat 6.2)
> but my impetus
> > is for work, which has a Windows platform requirement.
> >
> > I could also do a sanity check on the JAVA_LOCK stuff as I've done a
> > considerable amount of multi-threaded work and may have some
> insights (as an
> > outsider) into the issues with Tcl Blend.
> >
> > john
>
>
> That would be great. I think both Jiang, Scott, and I
> are in agreement that the JAVA_LOCK stuff in the JNI
> methods do not do anything useful. I think they were
> originally added before the Notifier class was part
> of Jacl and Tcl Blend. The Notifier class should
> be the sole synchronization point for adding an
> event to the Tcl event queue. The event is then
> pulled off the queue by the dedicated "event thread"
> and all command invocations after that are
> unsynchronized. This is a good thing because you
> end up with really low synchronization overhead.
>
> Currently, both the Tcl Blend and Jacl versions
> of the notifier seem to be thread safe, so it
> looks like you can just strip out all of the code
> that has anything to do with JAVA_LOCK. This
> JAVA_LOCK thingy is a big global lock that seemed
> to be needed in the old days of Tcl 8.0, but the
> 1.3 version of Tcl Blend only supports Tcl 8.3
> and Tcl 8.4 so that is no longer a concern. There
> is also global lock inside unix/unixNotifier.c
> and win/winNotifier.c that should only be used
> when Tcl is compiled without thread support.
> More detailed discussion of these issues
> can be found in the mailing list archive.
>
> The best way to get CVS access on a windows
> machine is to install Cygwin. You are going
> to need cygwin to build Tcl Blend on windows
> anyway, so you should just grab it now.
> Your best bet is to just get it from a mirror.
>
> Download the installer.
>
> ftp://ftp.freesoftware.com/pub/sourceware/cygwin/latest/setup.exe
>
> Run it and then point it at a mirror like
>
> ftp://ftp.freesoftware.com/pub/sourceware/cygwin/latest
> ftp://ftp.sunsite.utk.edu/pub/cygwin/latest/
>
> Then grab the soure for CVS and run ./configure. It should
> just configure and compile out of the box.
>
> Of course, it might be easier to just use a regular
> Unix box running samba and just mount that over
> the network on windows. That is what we do at work.
> Actually trying to use windows to do any sort of
> development work is much harder than developing
> software to run on windows.
>
> Mo Dejong
> Red Hat Inc.
>
> ----------------------------------------------------------------
> The TclJava mailing list is sponsored by Scriptics Corporation.
> To subscribe:    send mail to [EMAIL PROTECTED]
>                  with the word SUBSCRIBE as the subject.
> To unsubscribe:  send mail to [EMAIL PROTECTED]
>                  with the word UNSUBSCRIBE as the subject.
> To send to the list, send email to '[EMAIL PROTECTED]'.
> An archive is available at
> http://www.mail-archive.com/tcljava@scriptics.com
>
>

----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
An archive is available at http://www.mail-archive.com/tcljava@scriptics.com

Reply via email to