Merge branch 'td/fsmonitor-darwin-cookie-flush' into seen
The 'fsmonitor' daemon on macOS has been updated to flush pending FSEvents before waiting for the cookie file, to avoid premature timeouts on busy systems. * td/fsmonitor-darwin-cookie-flush: fsmonitor: flush pending FSEvents before cookie waitseen
commit
e2f575fb80
|
|
@ -206,6 +206,9 @@ static enum fsmonitor_cookie_item_result with_lock__wait_for_cookie(
|
|||
close(fd);
|
||||
unlink(cookie_pathname.buf);
|
||||
|
||||
/* The listener callback takes main_lock, so this must not block. */
|
||||
fsm_listen__flush_async(state);
|
||||
|
||||
/*
|
||||
* Wait for the listener thread to observe the cookie file.
|
||||
* Time out after a short interval so that the client
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ CFRunLoopRef CFRunLoopGetCurrent(void);
|
|||
extern CFStringRef kCFRunLoopDefaultMode;
|
||||
void FSEventStreamSetDispatchQueue(FSEventStreamRef stream, dispatch_queue_t q);
|
||||
unsigned char FSEventStreamStart(FSEventStreamRef stream);
|
||||
FSEventStreamEventId FSEventStreamFlushAsync(FSEventStreamRef stream);
|
||||
void FSEventStreamStop(FSEventStreamRef stream);
|
||||
void FSEventStreamInvalidate(FSEventStreamRef stream);
|
||||
void FSEventStreamRelease(FSEventStreamRef stream);
|
||||
|
|
|
|||
|
|
@ -496,6 +496,11 @@ void fsm_listen__stop_async(struct fsmonitor_daemon_state *state)
|
|||
pthread_mutex_unlock(&data->dq_lock);
|
||||
}
|
||||
|
||||
void fsm_listen__flush_async(struct fsmonitor_daemon_state *state)
|
||||
{
|
||||
FSEventStreamFlushAsync(state->listen_data->stream);
|
||||
}
|
||||
|
||||
void fsm_listen__loop(struct fsmonitor_daemon_state *state)
|
||||
{
|
||||
struct fsm_listen_data *data;
|
||||
|
|
|
|||
|
|
@ -493,6 +493,10 @@ void fsm_listen__stop_async(struct fsmonitor_daemon_state *state)
|
|||
state->listen_data->shutdown = SHUTDOWN_STOP;
|
||||
}
|
||||
|
||||
void fsm_listen__flush_async(struct fsmonitor_daemon_state *state UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Process a single inotify event and queue for publication.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -290,6 +290,10 @@ void fsm_listen__stop_async(struct fsmonitor_daemon_state *state)
|
|||
SetEvent(state->listen_data->hListener[LISTENER_SHUTDOWN]);
|
||||
}
|
||||
|
||||
void fsm_listen__flush_async(struct fsmonitor_daemon_state *state UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
static struct one_watch *create_watch(const char *path)
|
||||
{
|
||||
struct one_watch *watch = NULL;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,12 @@ void fsm_listen__dtor(struct fsmonitor_daemon_state *state);
|
|||
*/
|
||||
void fsm_listen__loop(struct fsmonitor_daemon_state *state);
|
||||
|
||||
/*
|
||||
* Prompt the listener to deliver queued filesystem events, if supported.
|
||||
* This does not wait for the events to be processed.
|
||||
*/
|
||||
void fsm_listen__flush_async(struct fsmonitor_daemon_state *state);
|
||||
|
||||
/*
|
||||
* Gently request that the fsmonitor listener thread shutdown.
|
||||
* It does not wait for it to stop. The caller should do a JOIN
|
||||
|
|
|
|||
Loading…
Reference in New Issue