[MacRuby-devel] Changeset 3398: mark Process.fork as not supported-implemented ... motivation?

Thibault Martin-Lagardette thibault.ml at gmail.com
Fri Jun 4 14:57:51 PDT 2010


Hi!

MacRuby makes intensive use of many system Frameworks and libraries, which makes us limited by the CAVEATS of fork(). What it means for us, is that we can use fork() for the typical pipe+dup2+fork+exec (any exec from the exec family) to run a binary and read its output. That's what we use for #` (well we actually use posix_spawn, but it is equivalent). But callin the exec() family is pretty much all we can safely do within a forked program. Because of the said caveats, we cannot do any kind of ruby execution, not even "just" calling #exec, since it would use the MacRuby dispatcher, the Obj-C runtime etc.
This makes it impossible for us to implement the "|-" argument to #read / #open, or the #fork method.

The main problem is that CoreFoundation would be involved within the two processes and share, for example, the same garbage collector.
What is not safe is using anything related to CoreFoundation within the new forked process (we could say it's not "fork-safe"), and the dispatcher as well as the MacRuby runtime make extensive use of Foundation / CF.
Even if the only operation within the child would be simply calling #exec (which we cannot make sure of anyway), calling this method would go through the runtime and the dispatcher, unfortunately unsafe.

I hope this explains it :-)
-- 
Thibault Martin-Lagardette



On Jun 4, 2010, at 14:50, macruby at djc.net wrote:

> Just curious: why was MacRuby added to the not-support list for fork() :
> 
> Changeset 3398: mark Process.fork as not supported-implemented.
> 
> Is there some subtle issue that will keep this from being implemented?
> 
> -Daniel
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20100604/a79aca51/attachment.html>


More information about the MacRuby-devel mailing list