Login  Register

Alien and callbacks from "foreign" threads?

Posted by Joachim Geidel on Jan 05, 2011; 5:22pm
URL: https://forum.world.st/Alien-and-callbacks-from-foreign-threads-tp3175989.html

Hi everybody,

I am close to releasing JNIPort (http://jniport.wikispaces.com) for Pharo and Squeak. Almost everything works on both Mac OS X and Windows with one exception. I can attach a Java VM to Pharo/Squeak, I can send messages to Java objects and get results back, and even callbacks from Java to Smalltalk seem to work.

The exception is that a callback from Java to Smalltalk which comes from a different thread leads to a crash of the Squeak VM. I have not been able to figure out what the problem is. There is a similar problem with a hook of the Java VM: one can register a callback function which is called whenever the Java VM produces output for stdout/stderr. With Pharo 1.1.1 on Mac OS X, using this hook works when the hook contains a "nil halt", and if I simply proceed in each of the notifiers. When I remove the halt or replace it by a Delay, the image freezes. In Squeak 4.1 on Windows, the behavior is different: the VM crashes.

Does Alien support callbacks coming from a "foreign" thread? Or is this a limitation of Alien?

Thanks in advance for any help,
Joachim Geidel