Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Hostetler <jeffhost@microsoft.com>2022-05-27 00:47:10 +0300
committerJunio C Hamano <gitster@pobox.com>2022-05-27 01:59:27 +0300
commitd06055501b0d31c417f8cbd237efb48065256d83 (patch)
tree77f532e9788611f1eb3db2125e286c732e7092d7 /fsmonitor--daemon.h
parent207534e423d95861c27444d4cf9760bf16edc6c8 (diff)
fsmonitor--daemon: stub in health thread
Create another thread to watch over the daemon process and automatically shut it down if necessary. This commit creates the basic framework for a "health" thread to monitor the daemon and/or the file system. Later commits will add platform-specific code to do the actual work. The "health" thread is intended to monitor conditions that would be difficult to track inside the IPC thread pool and/or the file system listener threads. For example, when there are file system events outside of the watched worktree root or if we want to have an idle-timeout auto-shutdown feature. This commit creates the health thread itself, defines the thread-proc and sets up the thread's event loop. It integrates this new thread into the existing IPC and Listener thread models. This commit defines the API to the platform-specific code where all of the monitoring will actually happen. The platform-specific code for MacOS is just stubs. Meaning that the health thread will immediately exit on MacOS, but that is OK and expected. Future work can define MacOS-specific monitoring. The platform-specific code for Windows sets up enough of the WaitForMultipleObjects() machinery to watch for system and/or custom events. Currently, the set of wait handles only includes our custom shutdown event (sent from our other theads). Later commits in this series will extend the set of wait handles to monitor other conditions. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fsmonitor--daemon.h')
-rw-r--r--fsmonitor--daemon.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/fsmonitor--daemon.h b/fsmonitor--daemon.h
index 2c6fa1a5d9..2102a5c9ff 100644
--- a/fsmonitor--daemon.h
+++ b/fsmonitor--daemon.h
@@ -34,9 +34,11 @@ void fsmonitor_batch__free_list(struct fsmonitor_batch *batch);
void fsmonitor_batch__add_path(struct fsmonitor_batch *batch, const char *path);
struct fsm_listen_data; /* opaque platform-specific data for listener thread */
+struct fsm_health_data; /* opaque platform-specific data for health thread */
struct fsmonitor_daemon_state {
pthread_t listener_thread;
+ pthread_t health_thread;
pthread_mutex_t main_lock;
struct strbuf path_worktree_watch;
@@ -51,7 +53,9 @@ struct fsmonitor_daemon_state {
struct hashmap cookies;
int listen_error_code;
+ int health_error_code;
struct fsm_listen_data *listen_data;
+ struct fsm_health_data *health_data;
struct ipc_server_data *ipc_server_data;
struct strbuf path_ipc;