4-implement-scene-switching-engine #4

Merged
boomjacky merged 16 commits from 4-implement-scene-switching-engine into master 2026-05-13 12:51:04 -04:00
Showing only changes of commit c8b9de8e81 - Show all commits

View File

@@ -7,6 +7,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -19,12 +20,15 @@ extern spsc_queue_t cmd_queue_main_fifo;
static void *pipe_thread_func(void *arg) {
(void)arg;
char line[LINE_MAX];
while (1) {
FILE *fifo = fopen(FIFO_PATH, "r");
if (!fifo) {
perror("fopen fifo");
return NULL;
}
char line[LINE_MAX];
while (fgets(line, sizeof(line), fifo)) {
/* strip newline */
size_t len = strlen(line);
@@ -69,8 +73,14 @@ static void *pipe_thread_func(void *arg) {
}
/* ignore unknown lines */
}
/* EOF all writers closed, reopen for next connection */
fclose(fifo);
return NULL;
{
struct timespec ts = {.tv_sec = 0, .tv_nsec = 50000000};
nanosleep(&ts, NULL);
} /* small pause before retrying */
}
return NULL; /* unreachable */
}
int pipe_start_reader(void) {