]> code.delx.au - gnu-emacs/commit
Improve w32notify notifications
authorFabrice Popineau <fabrice.popineau@gmail.com>
Sat, 19 Mar 2016 12:44:53 +0000 (14:44 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 19 Mar 2016 12:44:53 +0000 (14:44 +0200)
commit326fff41fa9f674d80be00b5c97c44f8043bbace
tree15f5e2fb315130ce923970d16a96c8e951914857
parent2fbdb1bb4c878f8ae17bd69d1b4ff51c47497e41
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.
src/w32inevt.c
src/w32notify.c
src/w32term.c
src/w32term.h
src/w32xfns.c
test/lisp/filenotify-tests.el