[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/kqueue 5154781 15/18: Continie with pending events
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] scratch/kqueue 5154781 15/18: Continie with pending events |
Date: |
Wed, 25 Nov 2015 14:11:20 +0000 |
branch: scratch/kqueue
commit 5154781141c2305c24103beb358453d30a838921
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
Continie with pending events
* src/kqueue.c (pending_events): Remove global variable.
(kqueue_compare_dir_list): Create `write' event for not used
pending events.
(globals_of_kqueue): Remove initialization of pending_events.
---
src/kqueue.c | 45 +++++++++++++++++++++++++++++++--------------
1 files changed, 31 insertions(+), 14 deletions(-)
diff --git a/src/kqueue.c b/src/kqueue.c
index fa54176..ca0e3e7 100644
--- a/src/kqueue.c
+++ b/src/kqueue.c
@@ -35,10 +35,6 @@ static int kqueuefd = -1;
/* This is a list, elements are (DESCRIPTOR FILE FLAGS CALLBACK [DIRLIST]). */
static Lisp_Object watch_list;
-/* Pending events, being the target of a rename operation.
- Items are (INODE FILE-NAME LAST-MOD LAST-STATUS-MOD SIZE). */
-static Lisp_Object pending_events;
-
/* Generate a list from the directory_files_internal output.
Items are (INODE FILE-NAME LAST-MOD LAST-STATUS-MOD SIZE). */
Lisp_Object
@@ -115,9 +111,11 @@ static void
kqueue_compare_dir_list
(Lisp_Object watch_object)
{
- Lisp_Object dir, old_directory_files, old_dl, new_directory_files, new_dl,
dl;
+ Lisp_Object dir, pending_events;
+ Lisp_Object old_directory_files, old_dl, new_directory_files, new_dl, dl;
dir = XCAR (XCDR (watch_object));
+ pending_events = Qnil;
old_directory_files = Fnth (make_number (4), watch_object);
old_dl = kqueue_directory_listing (old_directory_files);
@@ -198,6 +196,7 @@ kqueue_compare_dir_list
(watch_object, Fcons (Qrename, Qnil),
XCAR (XCDR (old_entry)), XCAR (XCDR (new_entry)));
new_dl = Fdelq (new_entry, new_dl);
+ pending_events = Fdelq (new_entry, pending_events);
}
the_end:
@@ -208,31 +207,50 @@ kqueue_compare_dir_list
/* Parse through the resulting new list. */
dl = new_dl;
while (1) {
- Lisp_Object new_entry;
+ Lisp_Object entry;
if (NILP (dl))
break;
/* A new file has appeared. */
- new_entry = XCAR (dl);
+ entry = XCAR (dl);
kqueue_generate_event
- (watch_object, Fcons (Qcreate, Qnil), XCAR (XCDR (new_entry)), Qnil);
+ (watch_object, Fcons (Qcreate, Qnil), XCAR (XCDR (entry)), Qnil);
/* Check size of that file. */
- Lisp_Object size = Fnth (make_number (4), new_entry);
+ Lisp_Object size = Fnth (make_number (4), entry);
if (FLOATP (size) || (XINT (size) > 0))
kqueue_generate_event
- (watch_object, Fcons (Qwrite, Qnil), XCAR (XCDR (new_entry)), Qnil);
+ (watch_object, Fcons (Qwrite, Qnil), XCAR (XCDR (entry)), Qnil);
dl = XCDR (dl);
- new_dl = Fdelq (new_entry, new_dl);
+ new_dl = Fdelq (entry, new_dl);
}
- /* At this point, both old_dl and new_dl shall be empty. Let's make
- a check for this (might be removed once the code is stable). */
+ /* Parse through the resulting pending_events_list. */
+ dl = pending_events;
+ while (1) {
+ Lisp_Object entry;
+ if (NILP (dl))
+ break;
+
+ /* A file is still pending. Assume it was a write. */
+ entry = XCAR (dl);
+ kqueue_generate_event
+ (watch_object, Fcons (Qwrite, Qnil), XCAR (XCDR (entry)), Qnil);
+
+ dl = XCDR (dl);
+ pending_events = Fdelq (entry, pending_events);
+ }
+
+ /* At this point, old_dl, new_dl and pending_events shall be empty.
+ Let's make a check for this (might be removed once the code is
+ stable). */
if (! NILP (old_dl))
report_file_error ("Old list not empty", old_dl);
if (! NILP (new_dl))
report_file_error ("New list not empty", new_dl);
+ if (! NILP (pending_events))
+ report_file_error ("Pending events not empty", new_dl);
/* Replace old directory listing with the new one. */
XSETCDR (Fnthcdr (make_number (3), watch_object),
@@ -456,7 +474,6 @@ void
globals_of_kqueue (void)
{
watch_list = Qnil;
- pending_events = Qnil;
}
void
- [Emacs-diffs] scratch/kqueue 90d6c69 07/18: * lisp/filenotify.el (file-notify-add-watch): Fix thinko., (continued)
- [Emacs-diffs] scratch/kqueue 90d6c69 07/18: * lisp/filenotify.el (file-notify-add-watch): Fix thinko., Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 99aa855 09/18: Doc changes for kqueue, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 7543d1c 02/18: Work on kqueue, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 5044bdf 12/18: New test with a larger number of events., Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 13f3508 10/18: Code cleanup of kqueue.c, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue e95b309 06/18: More work on kqueue, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue c8e266f 13/18: Handle more complex rename operation in kqueue, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 65ba5a9 11/18: Further fixes for kqueue., Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 8deebe1 08/18: Finish implementation in kqueue.c, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 6b490c0 14/18: Improve loops in file-notify-test06-many-events, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 5154781 15/18: Continie with pending events,
Michael Albinus <=
- [Emacs-diffs] scratch/kqueue e604e6a 18/18: Merge branch 'scratch/kqueue' of git.sv.gnu.org:/srv/git/emacs into scratch/kqueue, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 0247489 16/18: Rework file notifications, kqueue has problems with directory monitors, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 41d9bd0 05/18: Implement directory events, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue e3354e2 01/18: Add kqueue support, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue bec57a4 17/18: Some final fixes in file notification before merging with master, Michael Albinus, 2015/11/25