experiments

All kinds of coding experiments
Log | Files | Refs | Submodules

commit 65a76571285c33d5fe98d46ac6db38c60a7846c7
parent 59f3c21dab258363031fcd995d6801eb0ea75666
Author: Vetle Haflan <vetle@haflan.dev>
Date:   Sun, 29 Mar 2020 07:56:59 +0200

Modify c/fifo/writer.c (not sure if working, though)

Diffstat:
Mc/fifo/writer.c | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/c/fifo/writer.c b/c/fifo/writer.c @@ -2,6 +2,8 @@ #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> +#include <stdio.h> + int main() { @@ -12,9 +14,12 @@ int main() mkfifo(myfifo, 0666); /* write "Hi" to the FIFO */ - fd = open(myfifo, O_WRONLY); + fd = open(myfifo, O_WRONLY | O_ASYNC); write(fd, "Hi", sizeof("Hi")); + printf("Sent hi"); + sleep(1); // sleep until interrupt (SIGIO) write(fd, "you", sizeof("you")); + printf("Sent you"); close(fd); /* remove the FIFO */