diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-07-05 17:16:22 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-07-12 14:05:46 +0300 |
commit | 2ec10b952b40d287037a50387a8b66d9ccc5124b (patch) | |
tree | 95e9a8a97c3d5e6f333666c7266c84f6d9e38268 /event_notifier.c | |
parent | 5d62c43a17edaa7f6a88821c9086e6c8e0e5327d (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.c | 7 |
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; |