D called from Java
Juan Jose Comellas
jcomellas at gmail.com
Sun Aug 19 09:12:13 PDT 2007
Sorry, a small correction, both the D and the Java garbage collectors use
the SIGUSR1 and SIGUSR2 Unix signals to suspend and resume the process'
threads while the garbage collector is running.
Juan Jose Comellas wrote:
> You might have a problem if you have the D runtime and the JVM running
> within the same process on Linux/Unix. Both the D and the Java garbage
> collector (at least on JDK 1.4) use the SIGUSR1 and SIGUSR2 signals to
> suspend and resume the garbage collection process, so you might want to
> check whether there is any problem if a set of threads created in one
> section of the process (e.g. D runtime) get a signal to start the garbage
> collection from the other part of the process (e.g. JVM). I'm not sure if
> the D runtime is prepared to handle this situation.
>
> I had a problem with this when embedding the JVM in a program written in C
> that already used these signals for its own purposes.
>
>
> Frank Benoit wrote:
>
>> I am working on a framework to automate the process of binding Java and
>> D. See the dsource project TioLink.
>>
>> The main problem i see currently is, that both available D runtime
>> libraries - Phobos and Tango - do not have support for registering
>> Threads that are created "outside".
>>
>> If a dll (or .so) is called from Java, it is called always with several
>> threads. Even in a single threaded Java application. Java runs the
>> finalizer in an own Thread, so it is essential to be able to register
>> all calling threads on the library entry points. Only with this, the D
>> GC can savely do its job.
>>
>> Hopefully both runtime libs will have support for multithreaded
>> libraries in near future :)
More information about the Digitalmars-d
mailing list