On Friday, May 23, 2003, at 12:27 pm, Meg Crocker wrote:


Hi!

    Has anyone embedded perl in java with threads or multiple
interpreters?


Hi,


Sorry for not responding earlier, I have been on my honeymoon and now just arrived for YAPC.

I would first of all suggest you try a maintperl snapshot to get all the fixes that 5.8.1 will have.

    I'm trying to build something based on JPerl
(http://search.cpan.org/author/SBALA/jp_beta_1/) and I think I'm
running up against my clue barrier - I'm seeing segfaults and panics
("panic: top_env") when I try to run stuff, even with a single thread.

    I sprinkled in PERL_SET_CONTEXTs liberally, pretty much at the
beginning of any jperl function that uses a perl_ function or a perl
macro...


You need to make sure that only one thread is using one perl context at the same time, other bad stuff will happen. I suggest you look at the mod_perl 2 threaded mpm project to see how they are doing.


    Tips would be terribly appreciated.  I'm using perl5.8.0 and java
1.3 (hotspot jvm) on solaris 8.  Here's a stupid question to get you
started: My java is linked against libthread; perl seems to prefer
libpthread.  Do I need to make perl use libthread?  It looks like
libpthread uses libthread itself...


I have no idea actually, I am not a solaris expert.


Also:
    - Do I need to "use threads" or any thread functions in my perl?
    I haven't yet - I've started with a single interp called from a
    single java thread.  But I read in one older message that perl
    takes shortcuts if it doesn't think the thread stuff will actually
    be used?


No you don't, get the simple stuff working first.


    - Would all this be simpler with a mere multiplicity perl instead
      of a multiplicity-ithreads perl?  I think I'd still need to be
      able to call each interpreter from multiple threads to get the
      performance characteristics I'm looking for.


No, because a non ithreaded perl will not be able to run more than one perl interpreter at the same time.


Thanks.  :(
Meg Crocker


Arthur




Reply via email to