[Vm-dev] A problem with macOS VM

John McIntosh johnmci at smalltalkconsulting.com
Sat Oct 21 17:22:07 UTC 2017


Running the VM on the background thread won’t work because drawing and interactions any UI routines either via calls  in the VM or via some OBJ-C bridge must occur on the main thread. In the past many of the call were allowed (excluding drawing) 

But in High Sierra and iOS 11 Apple highlighted the issue by indicating in a debug build that your abuse of the rules was going to cause a fatal issue sometime in the future. There was a thread raised about this issue over in the Cincom VW mailing list asking when the VW product would be fixed as the VM there runs on a background thread.

Thus getting it to work is complex

The Squeak iOS flavor has to run on a background thread to avoid locking the touch UI but any UI work from the worker VM thread has to be carefully consider to avoid deadlocks.  Hence the objc bridge calls of execute on main thread 

I have spent the last year working in such an environment using MVVM as a pattern to solve cross thread main/worker message sends but dragons lurk. 

Ps Eliot wrote the Alien bridge, I just did the Mac OS port.

Sent from my iPhone

> On Oct 21, 2017, at 08:45, Esteban Lorenzano <estebanlm at gmail.com> wrote:
> 
> 
> Hi,
> 
> I discovered interacting with UI (for example, the menu)  in mac actually freezes the image.
> You can check it with this example: 
> 
> [ 30 timesRepeat: [
>    DateAndTime now crLog. 
>    1 second wait. ] ]
> 
> open a transcript and then go to play with the menu… you will see how the log stops. 
> I think this happens because the vm is running in the main thread. And I remember years ago the VM was running on a worker thread while now is running on a single thread but the logic for run on worker thread is still there so I changed that (is just uncommenting a method send and commenting another) but then when I executed VM I got this error: 
> 
> fish: './Pharo.app/Contents/MacOS/Ph...' terminated by signal SIGPROF (Profiling timer expired)
> 
> this is with fish, the shell I use… if I execute with bash I obtain a simple: 
> 
> ./Pharo.app/Contents/MacOS/Pharo: ./Pharo.app/Contents/MacOS/Pharo: cannot execute binary file
> 
> So… I would like to try again the worker thread, I feel is kind of bad the image freezes when interacting its (not much, but possible) native UI elements. Also, since I was woking on an ObjectiveC bridge (a simple port of John’s Alien bridge to UFFI), I want to enable the possibility of doing some native UI at least for macs.
> 
> cheers, 
> Esteban
> 
> 
> 


More information about the Vm-dev mailing list