Managing processes in C
# Functions
sigsuspend(const sigset_t *mask)
- tbdfork()
, wait()
, etc. - see pipex
# Notes
There’s a catch when fork()
ing after printf()
. The output from printf()
may be stored in a buffer, and that buffer gets copied after fork()
. So the buffer may be flushed twice (and printing something twice). Example:
|
|
Output:
|
|
It doesn’t happen if you call exec()
after fork()
though, because exec()
starts with fresh stdio buffers. More
here.