Set the inotify fd to non-blocking and read file changes

This commit is contained in:
Dimitri Lozeve 2021-02-26 19:55:08 +01:00
parent 1d6319e928
commit 2b683cb169
2 changed files with 20 additions and 1 deletions

View file

@ -2,6 +2,7 @@
#include <GLFW/glfw3.h>
#include <stdlib.h>
#include <sys/inotify.h>
#include <fcntl.h>
#include "log.h"
#include "renderer.h"
@ -25,6 +26,8 @@ int main(int argc, char *argv[]) {
perror("inotify_init");
return EXIT_FAILURE;
}
/* Set the inotify file descriptor to be non-blocking */
fcntl(state.inotify_fd, F_SETFL, O_NONBLOCK);
state.screen_shader.filename = argv[1];
state.screen_shader.wd =