[Vm-dev] VM Semaphores and external native threads

Ronie Salgado roniesalg at gmail.com
Thu Nov 9 01:56:50 UTC 2017


Hi,

I started to make an IDE like tool in Pharo, and I have an external library
for handling some asynchronous events generated in a separate thread, which
I am putting in a queue that I am polling each 200 ms from a Pharo image.
Currently I am using this library for handling pipes of external process
(GDB with the machine interface), and next I am going to add support for
inotify.

I know that I can remove this polling each 200 ms by implementing a
mechanism for registering multiples event handlers that are called by
ioProcessEvents. The SDL2DisplayPlugin registers an event handler in this
places, which asks SDL2 for the presence of events and it signals VM
Semaphore. However, since in this case I have control of the code in the
external thread, I would like to just signal the VM Semaphore in this
external thread to avoid this polling. So here is my question:

Is signaling a VM Semaphore thread safe? In case it is not, how much work
would require to make it thread safe.

Best regards,
Ronie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20171108/d9f114fc/attachment.html>


More information about the Vm-dev mailing list