From 85fa73ff322e42bfbc44f46078be588215f7e6f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 15 Oct 2004 17:00:51 +0000 Subject: [PATCH] stdio does work, too. Now uses waitpid() instead of wait_for_thread() - and surprise, it doesn't work yet :) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9372 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/apps/fork_test.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/kernel/apps/fork_test.c b/src/kernel/apps/fork_test.c index bad1ed8bab..4252cef5aa 100644 --- a/src/kernel/apps/fork_test.c +++ b/src/kernel/apps/fork_test.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -16,13 +17,14 @@ int main(int argc, char **argv) { pid_t child = fork(); + if (child == 0) { - write(1, "CHILD: is awake!\n", 17); - exit_thread(0); - //printf("CHILD: we're the child!\n"); + printf("CHILD: we're the child!\n"); + snooze(500000); // .5 sec + printf("CHILD: exit!\n"); } else if (child > 0) { printf("PARENT: we're the parent, our child has pid %ld\n", child); - wait_for_thread(child, NULL); + waitpid(-1, NULL, 0); } else fprintf(stderr, "fork() failed: %s\n", strerror(errno));