Ah, sorry, I'd misunderstood but it's clear now. I thought *Perl* was waiting in wait_for_callbacks(), but instead that is (as you said) a method, thus it's in the Java thread which is representing Perl, right? So what you now want to do is to provide "Perl services" from that thread for other threads in Java. Which makes perfect sense, and I guess I have nothing to add. And yeah -- it *is* confusing. :-)

Patrick LeBoutillier wrote:

Michael,

This 'server' is already existant and has been part of Inline::Java
since the start. What I'm now trying to do is take callback requests
from multiple Java threads and have them channelled through the single
thread that is communicating with Perl.


For that to happen, each object that makes callback request must
have a reference to the thread that is communication with Perl for the current session. It can then pass on that request to the thread
(which can forward the request to Perl when it's inside
wait_for_callbacks()).


Is that along the lines of what you where thinking? (I agree that this
is somewhat confusing and/or difficult to explain properly...)


Cheers,


Patrick


On Wed, 2003-11-19 at 16:28, Michael Roberts wrote:


Patrick LeBoutillier wrote:


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().


So .... effectively with the wait_for_callbacks() method, you are
creating a server in your process which fields requests from a
particular thread, right?  If you are creating this server, why not
make it more explicit (perhaps optionally) and allow it to field
requests from multiple Java threads?  Is that too naive?  Threaded
coding is not my forte.

Michael





Reply via email to