projects
/
dana
/
openbox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6de88d4
)
Avoid blocks on read() for inotify.
author
Dana Jansens
<danakj@orodu.net>
Mon, 24 Jan 2011 22:05:44 +0000
(17:05 -0500)
committer
Dana Jansens
<danakj@orodu.net>
Sun, 16 Oct 2011 22:54:04 +0000
(18:54 -0400)
When we come into the function we don't know how much data is available to
read. So just read a single event and return, so poll can figure out if there
is more for us or not.
obt/watch_inotify.c
patch
|
blob
|
history
diff --git
a/obt/watch_inotify.c
b/obt/watch_inotify.c
index 2aff0e394e8e89e2ee92783a85e515ba38fc0010..b55f5282a4fb3be38e4f000466d5ac914202fee7 100644
(file)
--- a/
obt/watch_inotify.c
+++ b/
obt/watch_inotify.c
@@
-301,6
+301,11
@@
static gboolean source_read(GSource *source, GSourceFunc cb, gpointer data)
}
g_free(full_path);
+
+ /* only read one event at a time, so poll can tell us if there
+ is another one ready, and we don't block on the read()
+ needlessly. */
+ break;
}
if (state == READING_NAME_HEAP)