aboutsummaryrefslogtreecommitdiff
path: root/event_notifier.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-07-05 17:16:22 +0200
committerAvi Kivity <avi@redhat.com>2012-07-12 14:05:46 +0300
commit2ec10b952b40d287037a50387a8b66d9ccc5124b (patch)
tree95e9a8a97c3d5e6f333666c7266c84f6d9e38268 /event_notifier.c
parent5d62c43a17edaa7f6a88821c9086e6c8e0e5327d (diff)
event_notifier: add event_notifier_set
EventNotifier right now cannot be used as an inter-thread communication primitive. It only works if something else (the kernel) sets the eventfd. Add a primitive to signal an EventNotifier that another thread is waiting on. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'event_notifier.c')
-rw-r--r--event_notifier.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/event_notifier.c b/event_notifier.c
index 0b829813d3..2b210f4b44 100644
--- a/event_notifier.c
+++ b/event_notifier.c
@@ -38,6 +38,13 @@ int event_notifier_get_fd(EventNotifier *e)
return e->fd;
}
+int event_notifier_set(EventNotifier *e)
+{
+ uint64_t value = 1;
+ int r = write(e->fd, &value, sizeof(value));
+ return r == sizeof(value);
+}
+
int event_notifier_test_and_clear(EventNotifier *e)
{
uint64_t value;