diff options
| author | mo <mokha@cisco.com> | 2016-06-24 16:16:10 -0400 |
|---|---|---|
| committer | mo <mokha@cisco.com> | 2016-06-24 16:16:10 -0400 |
| commit | c0f6fae97e81b84b45298614acea0a08b4cd6b04 (patch) | |
| tree | d85f8fe8efc3e34249f4731f408ea6a59bba2389 | |
| parent | 6bfe6482696164902f831aebae4a4ef99a0f9562 (diff) | |
| -rw-r--r-- | lab10/net.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lab10/net.c b/lab10/net.c index 7f52e20..bc811a0 100644 --- a/lab10/net.c +++ b/lab10/net.c @@ -91,10 +91,13 @@ void producer() int main() { - /* fork a child, if I'm the child, call producer and exit */ - - /* if I'm the parent, sleep for 1 second and call the consumer */ - + if (fork() == 0) { + /* start the producer/server first */ + producer(); + exit(0); + } /* parent process proceeds here */ + sleep(1); + consumer(); exit(0); } |
