Hi, So⦠âmultithreadâ is a complicated issue. Pharo as most Smalltalks is designed thinking is as monolithic so if you are trying to make the image to work in different processes⦠it will not be easy at all :) Time ago Eliot did a prototype (more than a prototype in fact, but still far from âproduction readyâ) to have Threaded FFI and Iâm quite sure this is the way to go, at least as a 1st milestone. I already have a process building this experimental VM: https://ci.inria.fr/pharo/view/VM/job/CogMTVM/ <https://ci.inria.fr/pharo/view/VM/job/CogMTVM/> (No idea why windows build failed last two times⦠this can be a random fail). I do not remember exactly the changes needed in the image to take advantage of it⦠it was just an instVar in Process, I think, but then FFI package was adapted to take advantage of this⦠no idea where it is now (if is already incorporated in latest FFI, which we have). Then, after this⦠I imagine the callback mechanism can be adapted to work in multithread environments but probably we will need something like isolates from Dart to provide some degree of multithread processing without killing the image (but Iâm just thinking in loud here, this can be a really bad idea, and probably there are other ways to do this better⦠I will let Eliot to explain better). TL;DR: Start for the CogMTVM, is the way to go. cheers, Esteban
On 17 Apr 2015, at 09:06, Nicolai Hess <nicolaihess@web.de> wrote:
Hi,
I've tried to build a pharovm with multithread support. I changed the config in the pharo generator.image to use the cogmt config and was able to build a vm. But this vm crashes on startup. (windows7)
Is this the right way and did anyone got this to work (windows or linux)?
And can this work to make NB callbacks working for multithreaded libraries.
(I made some simple bindings for the gstreamer lib with NB, this works for simple calls (create element/change state). But I guess this won't work for any gstreamer function that requests a callback that may b e called from a different thread)
Would this be the right way to do: - build a vm with MT support - guard the NB callback entry/leave code with the ownVM()/disownVM() call.
Or is there more to do.
Thanks in advance
nicolai