yo/concrete/fork2/fork/forkfork.cc
raw| 1 | #include "fork.ih" |
| 2 | |
| 3 | void Fork::fork() const |
| 4 | { |
| 5 | int pid = ::fork(); |
| 6 | |
| 7 | if (pid == 0) // childprocess has pid == 0 |
| 8 | { |
| 9 | d_redirector.childRedirections(); |
| 10 | d_child.run(); |
| 11 | } |
| 12 | |
| 13 | d_redirector.parentRedirections(); |
| 14 | d_parent.run(pid, |
| 15 | d_redirector.readChildCout(), |
| 16 | d_redirector.readChildCerr(), |
| 17 | d_redirector.writeChildCin()); |
| 18 | } |