[Pharo-project] [Vm-dev] Re: Can OSProcess functionality be implemented using FFI instead of plugin?

Mariano Martinez Peck marianopeck at gmail.com
Sun Jan 17 00:49:09 UTC 2016

On Sat, Jan 16, 2016 at 9:37 PM, Levente Uzonyi <leves at caesar.elte.hu>

> On Sat, 16 Jan 2016, Mariano Martinez Peck wrote:
> (Still no quote.)
> How will you read the output of the process without having your image's
> process blocked in the FFI callout?
> How will you make sure that writes to input of the process won't block the
> FFI callout

I don't see how your question are related to what I proposed of creating a
plugin who exports constants. And I also don't understand what would change
in that regard wether it is via FFI or plugin. Could you explain please?

In any case, for the reading, I simply use none blocking pipes. Something
like this:

fcntl(descriptor, F_SETFL, flags | O_NONBLOCK)

That way the read operations won't block and simply answer what is
available on the pipe. Then, from image side, is up to the user to decide
how to get it. Could be a polling loop or whatever.

Something I wanted to give it a try one day is to use blocking pipes but
with threaded FFI callouts. But until that's in place, using non blocking
pipes plus a image side polling is that I am using.

The writing to the stdin I think it's blocking, although I think there is
non blocking writing possibility too, but I never tried.

Does this answer your question?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20160116/f67cd28c/attachment-0001.htm

More information about the Vm-dev mailing list