yo/concrete/examples/fork.h
raw| 1 | //CLASS |
| 2 | class Fork |
| 3 | { |
| 4 | int d_pid; |
| 5 | |
| 6 | public: |
| 7 | virtual ~Fork(); |
| 8 | void fork(); |
| 9 | |
| 10 | protected: |
| 11 | int pid() const; |
| 12 | int waitForChild(); // returns the status |
| 13 | |
| 14 | private: |
| 15 | virtual void childRedirections(); |
| 16 | virtual void parentRedirections(); |
| 17 | |
| 18 | virtual void childProcess() = 0; // pure virtual members |
| 19 | virtual void parentProcess() = 0; |
| 20 | }; |
| 21 | //= |
| 22 | //PID |
| 23 | inline int Fork::pid() const |
| 24 | { |
| 25 | return d_pid; |
| 26 | } |
| 27 | //= |