[Vm-dev] Running the VM in another thread
pierce at samadhiweb.com
Mon Feb 3 11:12:06 UTC 2020
On Sun, Feb 02, 2020 at 11:25:07PM -0800, Eliot Miranda wrote:
> > Is this A or B?
> > A - Not meant to work. The VM must run on the main thread. On Linux the
> > program only ran by happenstance.
> > B - Meant to work. Crashing on MacOS is a bug.
> C. There are restrictions on interacting with the GUI on MacOS. I’m
> not an expert here. John McIntosh can state what the restrictions are.
I should've been clearer. The program is command line only, there is no
GUI. It is really just one step beyond hello world. I've attached it in
On MacOS I created an Xcode project to link with the Pharo/Squeak VM
framework because it is quicker that way.
> I’m curious why you want to run the vm in another thread. I’m curious
> what your goals are here. There are a number of potential viable
> paths to take wrt the vm and threading.
In the headless branch of Pharo's fork, the Smalltalk image access
routines have been made pluggable. Pablo Tesone created an example that
reads the image from a Windows resource that is embedded into a compiled
I implemented the image-in-Windows-resource access routines in Free
Pascal as that functionality comes for free with Free Pascal and is
With a couple of FFI, I then have a single-source Pascal program that
builds on Linux, MacOS and Windows, that runs a Pharo image embedded in
a Windows resource embedded in said Pascal program.
Then I rewrote the Pascal program to use pthreads. It works on Linux but
crashes on MacOS, so I wrote the C pthread program mentioned in this
My goal is to determine feasibility of building GUIs with Free Pascal /
Lazarus, while running Pharo on another thread handling app logic, with
its image embedded and read-only, and have the two communicate via IPC.
Actually, on desktops, running the VM on another thread is not that
important, because I can and should follow the Firefox/Chrome
multi-process architecture, with GUI and embedded Pharo as separate
compiled programs running in separate OS processes.
On iOS/Android, being able to run the VM in another thread might still
- https://github.com/tesonep/pharo-vm-embedded-example (Pablo's example)
- https://github.com/PierceNg/pharo-vm-embedded-pascal (My Pascal experimentation)
- https://www.lazarus-ide.org/ (Lazarus)
- https://www.freepascal.org (Free Pascal)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 642 bytes
Desc: not available
More information about the Vm-dev