t0610: fix non-portable variable assignment
[alt-git.git] / compat / fsmonitor / fsm-listen.h
blob41650bf897221767b46566e17e470e24209911fe
1 #ifndef FSM_LISTEN_H
2 #define FSM_LISTEN_H
4 /* This needs to be implemented by each backend */
6 #ifdef HAVE_FSMONITOR_DAEMON_BACKEND
8 struct fsmonitor_daemon_state;
11 * Initialize platform-specific data for the fsmonitor listener thread.
12 * This will be called from the main thread PRIOR to staring the
13 * fsmonitor_fs_listener thread.
15 * Returns 0 if successful.
16 * Returns -1 otherwise.
18 int fsm_listen__ctor(struct fsmonitor_daemon_state *state);
21 * Cleanup platform-specific data for the fsmonitor listener thread.
22 * This will be called from the main thread AFTER joining the listener.
24 void fsm_listen__dtor(struct fsmonitor_daemon_state *state);
27 * The main body of the platform-specific event loop to watch for
28 * filesystem events. This will run in the fsmonitor_fs_listen thread.
30 * It should call `ipc_server_stop_async()` if the listener thread
31 * prematurely terminates (because of a filesystem error or if it
32 * detects that the .git directory has been deleted). (It should NOT
33 * do so if the listener thread receives a normal shutdown signal from
34 * the IPC layer.)
36 * It should set `state->listen_error_code` to -1 if the daemon should exit
37 * with an error.
39 void fsm_listen__loop(struct fsmonitor_daemon_state *state);
42 * Gently request that the fsmonitor listener thread shutdown.
43 * It does not wait for it to stop. The caller should do a JOIN
44 * to wait for it.
46 void fsm_listen__stop_async(struct fsmonitor_daemon_state *state);
48 #endif /* HAVE_FSMONITOR_DAEMON_BACKEND */
49 #endif /* FSM_LISTEN_H */