On 2007/12/07, "Dave Korn" <[EMAIL PROTECTED]> wrote: > > On the other hand, the setting of environ is very dubious and is > > likely to break on real systems. The code should be changed to call > > execve instead. Unfortunately there is no standard execvpe function. > > Fortunately gcc never uses the variant which sets environ. Offhand > > I'm not sure what does. > > Perhaps we could work around this case by setting environ in the parent > before the vfork call and restoring it afterward, but we'd need kind of > serialisation there, and I don't know how to do a critical section using > pthreads/posix.
You can do a critical section mainly between processes using system calls of IPC synchronization like filelocks, RPCs, shared memory with mmap and mutexes/semaphores, messages passing through pipes as tunnels, MPI, etc. Now well, a critical section between multithreaded processes are complicated. J.C.Pizarro