Browse thread
[Caml-list] Client/Server socket communication
-
IKEDA Katsumi
-
tim@f...
- IKEDA Katsumi
- Alessandro Baretta
-
tim@f...
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Alessandro Baretta <alex@b...> |
| Subject: | Re: [Caml-list] Client/Server socket communication |
Tim Freeman wrote: >>Why "server <defunct>" is occurred. >>What do I have to do to correct <defunct> ? > > > This is a Unix thing, not an OCAML thing. The child will be defunct > to hold the exit status so it can be reported to the parent when the > parent waits for it, or until the parent exits. > > One workaround is to wait for the child process when you expect it to exit. > > Another workaround is to fork twice, so the original process is the > parent of a temporary process, and the temporary process is the parent > of the process you really wanted to create. The temporary process > exits immediately and the original parent waits for it immediately. > This leaves no defunct processes. > A third workaround might be to use SIGCHLD handler to asynchronously call wait or waitpid, but there might be issues with the non-reentrance-with-respect-to-signals of the libc. I doubt O'Caml could be any more signal-safe than libc. A fourth workaround is to use O'Caml threads, which do not require the kernel to instantiate a new process, so no new pid is allocated. Alex ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners