dynstage: don't destroy library filewatch on deletion

This commit is contained in:
Andrei Alexeyev 2022-03-01 00:21:17 +02:00
parent c668267888
commit d2c01b8ce5
No known key found for this signature in database
GPG key ID: 72D26128040B9690

View file

@ -55,7 +55,6 @@ static struct {
int recompile_delay;
int rescan_delay;
int lib_gen_bump_delay;
pid_t recompile_pid;
} dynstage;
static stageslib_t dynstage_dlopen(void) {
@ -129,12 +128,12 @@ static bool dynstage_filewatch_event(SDL_Event *e, void *ctx) {
if(watch == dynstage.lib_watch) {
switch(fevent) {
case FILEWATCH_FILE_UPDATED:
log_debug("Library updated");
dynstage_bump_lib_generation();
break;
case FILEWATCH_FILE_DELETED:
filewatch_unwatch(dynstage.lib_watch);
dynstage.lib_watch = NULL;
log_debug("Library deleted");
break;
}
@ -149,13 +148,11 @@ static bool dynstage_filewatch_event(SDL_Event *e, void *ctx) {
}
static void dynstage_sigchld(int sig, siginfo_t *sinfo, void *ctx) {
pid_t cpid;
attr_unused pid_t cpid;
int status;
while((cpid = waitpid(-1, &status, WNOHANG)) > 0) {
if(cpid == dynstage.recompile_pid) {
dynstage.recompile_pid = 0;
}
log_debug("Process %i terminated with status %i", cpid, status);
}
}