fork(2)
is kludgey under Cygwin, as the Windows process model does not easily allow it to happen. Cygwin may allow its spawn to use it, but you're going to suffer a serious performance hit as Cygwin has to emulate everything by hand -- including copying the executable data, copying the open handles, etc.
Depending on how much shotgun uses fork(2)
, this emulation could be painful or it could be relatively minor.
Here's a good thread on GameDev.net discussing the lack of a fork
facility on Win32. They bring up something which I don't have the patience or platform accessibility to investigate, but certainly sounds fun, dangerous, and explosive all at the same time:
So, you need to bypass Win32 and call the native API ({Nt|Zw}CreateProcess). The book "Windows Nt/2000 Native Api Reference" has an example "Forking a Win32 Process". This may be what you need.
I'm intrigued, but I doubt Cygwin uses it. It's probably there, to reiterate my answer to your question -- a lot of Unix apps rely on fork
, and Cygwin likely makes it available. Just don't expect miracles, and you'll have to make Ruby aware of Cygwin by recompiling it to include its emulation layer.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…