mirror of
https://github.com/rdmsr/zag.git
synced 2026-10-27 13:58:20 +00:00
ke: add reset to event
This commit is contained in:
+9
-2
@@ -8,9 +8,9 @@ pub const Event = struct {
|
|||||||
const Self = @This();
|
const Self = @This();
|
||||||
|
|
||||||
pub const Type = enum {
|
pub const Type = enum {
|
||||||
/// Wake only one waiter.
|
/// Wake only one waiter and decrease signaled.
|
||||||
Synchronization,
|
Synchronization,
|
||||||
/// Wake all waiters.
|
/// Wake all waiters a keep signaled high.
|
||||||
Notification,
|
Notification,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -29,4 +29,11 @@ pub const Event = struct {
|
|||||||
ki.wait.satisfy_wait(&self.hdr);
|
ki.wait.satisfy_wait(&self.hdr);
|
||||||
self.hdr.lock.release(ipl);
|
self.hdr.lock.release(ipl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Reset an event.
|
||||||
|
pub fn reset(self: *Self) void {
|
||||||
|
const ipl = self.hdr.lock.acquire();
|
||||||
|
self.hdr.signaled = 0;
|
||||||
|
self.hdr.lock.release(ipl);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user