On Fri, Feb 24, 2012 at 12:13 AM, Andy Wingo wrote: > On Thu 23 Feb 2012 16:49, Nala Ginrut writes: > > > I just want to do my negative vote when I saw "choose thead then fork > > die", but I see "open-process" soon. ;-) So, what's the difference > > between "primitive-fork" and "open-process"? If they're different, I > > think much code to be modified for me...I believe I'm not the only > > layman to use "fork" and "thread" both. > > Open-process is at the guts of the (ice-9 popen) modules. Open-pipe* is > a thin wrapper around it -- see "Pipes" in the manual. > > Basically open-pipe* / open-process does a fork(), and then an exec(). > Doing this yourself in Scheme is actually impossible with threads, > because you'll need to take Scheme strings and produce C strings in the > current locale, to pass to the exec call. That involves malloc, iconv, > and libgc allocation, and none of them are guaranteed to work after a > fork(), in a multithreaded program. > > I think I could use pipes to handle some sub-process rather than do it with fork manually. But I must create a daemon, it can't avoid to use fork, will this circumstance cause problems if I use threads after it? > Andy > -- > http://wingolog.org/ >