I believe Async or Core comes with a daemonize module you can use to
accomplish this.
Alternatively you can do your forking and everything before running the
scheduler, so old school rules apply there.
And I think 'Core' referrers to the 'Core Suite', of which Async is a
member.
Paolo Donadeo <
p.do...@gmail.com> writes:
> When writing a daemon, using the standard Unix module, I usually send the
> "main" function to background using the classical double-fork technique:
>
> *match fork () with*
> *| 0 -> if fork () <> 0 then exit 0;*
> * (* do whatever the child should do *)*
> *| _ -> wait ();*
> * (* do whatever the parent should do *)*
>
> *(source code stolen from *Unix system programming in OCaml
> <
http://ocamlunix.forge.ocamlcore.org/processes.html>*)*
>
> In Async of course this don't work. How can I achieve the same result?
>
> BTW, I'm still writing in the Core mailing list about Async, is it ok?
>
>
> --
> *Paolo*