Mark, On Tue, 2003-11-18 at 18:31, Mark Fowler wrote:
> I'm getting a java.lang.UnsatisfiedLinkError 'jni_callback'. This only > happens from within the actionPerformed method (it works fine if I try > calling the same thing in the constructor,) so I'm guessing it's a problem > with calling back from a seperate thread? This is my biggest priority for the next release. Seems Inline::Java is working well enough that more and more people are taking it into more adventurous territory (like multiple threads calling back...) I took a crack at it with Jay ([EMAIL PROTECTED]) (see CC:) a few weeks back and that didn't lead to anything, but now I think I'm on to a new approach that should work. Here's the basic details of the problem if anyone has some ideas: - The way callbacks are implemented presently is completely synchronous. This means that a callback can only be called if the Perl side is waiting for a previous method call to terminate on the Java side. - I do not want to start threads in Perl or rewrite the entire thing to make it event-driven to accomodate for this case. The solution I'm looking at right now involves the following ideas: - I will create a wait_for_callbacks() method that one will need to call when the process must stop and wait for callbacks. There will have to be some mechanism to return from this method when needed. - Only the thread which communicates with Inline::Java will be allowed to create objects that can callback into Perl (extend InlineJavaPerlCaller) - Each InlineJavaPerlCaller will know which thread created it and will pass callbacks to that thread so that it can forward them to Inline::Java, assuming that thread is in wait_for_callbacks(). I'm not 100% sure of how I'll go about implementing this, so all suggestions are welcome. This feature I believe will make Inline::Java much more useable for GUI applications and other thread-based designs. Cheers, Patrick ===================== Patrick LeBoutillier Laval, Québec, Canada