foot/reaper.h
Daniel Eklöf 3c6789fb8b
reaper: add optional callback
When calling ‘reaper_add()’, the caller can provide a callback. If
non-NULL, the reaper will call the callback to handle the actual
reaping.

If the callback is NULL, or if it returns false, the reaper reaps the
child process.
2020-12-26 01:26:54 +01:00

15 lines
336 B
C

#pragma once
#include <stdbool.h>
#include <sys/wait.h>
#include "fdm.h"
struct reaper;
struct reaper *reaper_init(struct fdm *fdm);
void reaper_destroy(struct reaper *reaper);
typedef bool (*reaper_cb)(struct reaper *reaper, pid_t pid, void *data);
void reaper_add(struct reaper *reaper, pid_t pid, reaper_cb cb, void *cb_data);