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-03-25 21:03:11 +0300
committerJunio C Hamano <gitster@pobox.com>2022-03-26 02:04:17 +0300
commitb05880d357c6dadba8d1d7943f4782fc25e06999 (patch)
tree47cf5937ecd1f6c2e260a7fdc0a9f4e052bd6b9c /fsmonitor--daemon.h
parent50c725d6b6f52b1c7fc4940c092d7f205cb99583 (diff)
fsmonitor--daemon: use a cookie file to sync with file system
Teach fsmonitor--daemon client threads to create a cookie file inside the .git directory and then wait until FS events for the cookie are observed by the FS listener thread. This helps address the racy nature of file system events by blocking the client response until the kernel has drained any event backlog. This is especially important on MacOS where kernel events are only issued with a limited frequency. See the `latency` argument of `FSeventStreamCreate()`. The kernel only signals every `latency` seconds, but does not guarantee that the kernel queue is completely drained, so we may have to wait more than one interval. If we increase the latency, the system is more likely to drop events. We avoid these issues by having each client thread create a unique cookie file and then wait until it is seen in the event stream. Co-authored-by: Kevin Willford <Kevin.Willford@microsoft.com> Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de> 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.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fsmonitor--daemon.h b/fsmonitor--daemon.h
index 010fbfe60e..bd09fffc17 100644
--- a/fsmonitor--daemon.h
+++ b/fsmonitor--daemon.h
@@ -45,6 +45,11 @@ struct fsmonitor_daemon_state {
struct fsmonitor_token_data *current_token_data;
+ struct strbuf path_cookie_prefix;
+ pthread_cond_t cookies_cond;
+ int cookie_seq;
+ struct hashmap cookies;
+
int error_code;
struct fsmonitor_daemon_backend_data *backend_data;