here's a different little hack that's more unix-specific, which i borrowed from unix libthread (i think that's where i saw it, although it might be well-known in fcntl land).
a parent process needs to know whether a child has successfully done an exec of an arbitrary program (so it's hard to have that program tell the parent). the parent makes a pipe, marks the child's end as close-on-exec, forks, and then reads its end of the pipe. if the exec succeeds, the read returns 0; if the exec fails, the child writes the diagnostic on the pipe, so again the read returns something.
--- Begin Message ---boyd would put keys in pipes so core dumps (incidental or nasty) wouldn't give them away. interesting to think about, given my current plumbing problems (water not bytes). brucee On 3/26/06, Lyndon Nerenberg <[EMAIL PROTECTED]> wrote: > > On Mar 25, 2006, at 8:12 AM, Russ Cox wrote: > > > much like the old trick of storing a byte in a pipe > > and using it as an interprocess lock. > > It's a brilliant trick. It let us write some very portable code (to > windows, too, no less) with almost no effort. Don't knock > inginuity. (Or insanity. But that's just labels ...) > > --lyndon >
--- End Message ---
