2 ** Copyright 2003, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
8 #include <sys/syscalls.h>
10 static int pipe_read_thread(void *args
)
12 int fd
= *(int *)args
;
18 err
= read(fd
, buf
, sizeof(buf
));
19 printf("pipe_read_thread: read returns %d\n", err
);
39 printf("pipe returns %d\n", err
);
40 printf("%d %d\n", fds
[0], fds
[1]);
43 id
= _kern_thread_create_thread("pipe read thread", &pipe_read_thread
, &fds
[1]);
44 _kern_thread_resume_thread(id
);
48 err
= write(fds
[0], "this is a test", sizeof("this is a test"));
49 printf("write returns %d\n", err
);
59 // close the reader end and write to it
61 err
= write(fds
[0], "this is a test", sizeof("this is a test"));
62 printf("write returns %d\n", err
);