[mercury-users] Calling Mercury code from a threaded enviromnent?

Roy Ward rward at infoscience.otago.ac.nz
Mon Feb 4 15:26:09 AEDT 2002


Hi,

Has anyome had any luck at all in calling Mercury
code from a threaded environment in Linux?

I've got some code written in Mercury that I want
to access from a Java system, and I've been unable
to get anything to work. As a workaround, I'm willing
to set up a CORBA server. My API is pretty simple -
it just needs to be passed a string and returns a string
(and read a couple of files as part of processing)

Attempts so far:

* Tried creating a shared library, and calling from
JNI: segmentation fault in garbage collector with all
versions of Java that I tried other than the Blackdown
JDK 1.1 (which I think uses Green Treads in any case).
No use as the rest of our system uses JDK 1.2.
This awas a problem even with a toy example - I didn't
try it on anything large.

* Tried using MCORBA, works fine with a toy
example, gives a segmentation fault (or other errors)
when any more than a tiny amout of processing
(such as my code) happens in Mercury.

* Tried using a shared library and writing the ORB
wrapper code myself - same segementation fault
as MCORBA.

* The shared library does work correctly when a called
from a simple C++ wrapper.

Has anyone got anything working with any of these?
(apart from the toy example with MCORBA).

My code does work as expected if I don't go through
any wrappers, so it's not a problem inherent in the
code I'm calling.

I have been using:
Redhat Linux 7.1
gcc 2.95.3
Mercury rotd-2002-01-07
grade: hlc.par.gc
MCORBA from cvs
OmniORB 2.8
lots of different JVMs - IBM, Sun, Blackdown from
JDK 1.1-1.4

I'm about to explore getting OmniORB running in
single-threaded mode, but it occured to me that
someone else might have found (and resolved?) this
problem.

I've had a local expert looking at this, and he thinks
that the problem is that the Boehm-GC is not set
up to put wrappers around the pthread_create calls,
so the Garbage Collection gets confused by not knowing
about all the threads.

I'm getting somewhat desperate here, as unless I can
get something working I may have to abandon Mercury
for this project and port the whole thing to Java :-(.

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list