[MLton-user] fork() in MLton on Cygwin
Garbage Collection
g4rb4g3c0ll3ct10n@yahoo.com
Fri, 9 Jul 2004 09:33:02 -0700 (PDT)
I want to use fork() in MLton on Cygwin and would like
to know why it's disabled. I've seen reference to a
"Cygwin fork/mmap bug" in
basis-library/posix/process.sml. Is there a concrete
example of this bug?
After trying to use a C fork() wrapper and debugging
the binary with gdb, I discovered a few changes that
allow fork() to work (at least superficially) on
Cygwin. I got a simple program (it forks and prints
from parent and child) to work after recompiling MLton
with the following changes:
basis-library/posix/process.sml:
removed the val fork = ..., so the fork syscall is
always used (the old synchronization mechanism doesn't
seem necessary)
runtime/gc.c:
removed #include <windows.h>
replaced VirtualAlloc/VirtualFree (which aren't
tracked by Cygwin) with mmap/munmap
replaced showMem() with a stub version
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail