diff options
author | Fabrice Popineau <fabrice.popineau@gmail.com> | 2016-03-19 14:44:53 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2016-03-19 14:44:53 +0200 |
commit | 326fff41fa9f674d80be00b5c97c44f8043bbace (patch) | |
tree | 15f5e2fb315130ce923970d16a96c8e951914857 /src/w32term.h | |
parent | 2fbdb1bb4c878f8ae17bd69d1b4ff51c47497e41 (diff) | |
download | emacs-326fff41fa9f674d80be00b5c97c44f8043bbace.tar.gz |
Improve w32notify notifications
* src/w32notify.c (DIRWATCH_BUFFER_SIZE): New macro.
(struct notification): 'terminate' is now a HANDLE.
(send_notifications): Argument is now a pointer to a
notification. Don't loop waiting for the notification to be
acknowledged by the main thread; instead, just add the
notification to the linked list of notifications waiting to be
acknowledged.
(watch_end): Don't close the directory handle.
(watch_completion): Allocate a new notification structure to be
added to the notifications set. Call ReadDirectoryChangesW
immediately after adding the new notification, and before sending
a message to the main thread about them.
(watch_worker): Don't loop calling ReadDirectoryChangesW; instead,
call it just once -- it will be called again in watch_completion.
Loop waiting for the main thread's indication to terminate.
(start_watching): Create the event to be used to indicate to the
worker thread that its should terminate.
(remove_watch): Indicate to the worker thread that it should
terminate.
* src/w32term.c (queue_notifications): Loop over all the
notifications in the linked list, processing all of them in one
go.
* src/w32inevt.c (handle_file_notifications): Loop over all the
notifications in the linked list.
* src/w32xfns.c (init_crit): Initialize the linked list of file
notifications.
(delete_crit): Free the linked list of file notifications,
including any unprocessed notifications left in it.
* src/w32term.h (struct notifications_se): New struct.
* test/lisp/filenotify-tests.el (file-notify-test02-events)
(file-notify-test05-dir-validity): Add read-event calls to
facilitate event recognition by the main thread in batch mode.
Diffstat (limited to 'src/w32term.h')
-rw-r--r-- | src/w32term.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/w32term.h b/src/w32term.h index d809be3c03d..8585c8190db 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -727,10 +727,18 @@ extern void x_delete_display (struct w32_display_info *dpyinfo); extern void x_query_color (struct frame *, XColor *); -extern volatile int notification_buffer_in_use; -extern BYTE file_notifications[16384]; -extern DWORD notifications_size; -extern void *notifications_desc; +#define FILE_NOTIFICATIONS_SIZE 16384 +/* Notifications come in sets. We use a doubly linked list with a + sentinel to communicate those sets from the watching threads to the + main thread. */ +struct notifications_set { + LPBYTE notifications; + DWORD size; + void *desc; + struct notifications_set *next; + struct notifications_set *prev; +}; +extern struct notifications_set *notifications_set_head; extern Lisp_Object w32_get_watch_object (void *); extern Lisp_Object lispy_file_action (DWORD); extern int handle_file_notifications (struct input_event *); |