Login  Register

Re: Alien and callbacks from "foreign" threads?

Posted by Eliot Miranda-2 on Jan 05, 2011; 6:25pm
URL: https://forum.world.st/Alien-and-callbacks-from-foreign-threads-tp3175989p3176106.html

Hi Joachim,

On Wed, Jan 5, 2011 at 9:22 AM, Joachim Geidel <[hidden email]> wrote:

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?

That current version of Alien does /not/ support callbacks from foreign threads.  I have a prototype that does support callbacks from foreign threasds and supports non-blocking callouts on arbitrary threads.  Essentially the VM shares the VM between native threads such that only one thread can be running Smalltalk at any one time but that any number of natie thresds can share the VM.

I demonstrated this to various people in Concepcíon during Smalltalks 2010.  Are you interested in working with this prototype code?  Pleaze let me know either way.   I haven't sought permission to release this code yet but I would very much like to.  I think there's value to Teleplace in my releasing it before we release it internally because it needs pounding on to bring up to production quality.  If there's significant interest in this code I'll ask for permission to release it and see where we go from there.


Thanks in advance for any help,
Joachim Geidel

--
View this message in context: http://forum.world.st/Alien-and-callbacks-from-foreign-threads-tp3175989p3175989.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.