pkg/libuv: get rid of sleep state, it did nothing

This commit is contained in:
Mitchell Hashimoto
2022-10-23 16:15:47 -07:00
parent 34e1c96dd7
commit c3d9ee1d85

View File

@ -23,7 +23,6 @@ mutex: Mutex,
cond: Cond,
ready: bool = false,
terminate: BoolAtomic,
sleeping: BoolAtomic,
callback: std.meta.FnPtr(fn () void),
thread: ?Thread,
@ -39,7 +38,6 @@ pub fn init(
.mutex = try Mutex.init(alloc),
.cond = try Cond.init(alloc),
.terminate = BoolAtomic.init(false),
.sleeping = BoolAtomic.init(false),
.callback = callback,
.thread = null,
};
@ -97,18 +95,6 @@ fn threadMain(self: *Embed) void {
const fd = self.loop.backendFd() catch unreachable;
const timeout = self.loop.backendTimeout();
// If the timeout is negative then we are sleeping (i.e. no
// timers active or anything). In that case, we set the boolean
// to true so that we can wake up the event loop if we have to.
if (timeout < 0) {
log.debug("going to sleep", .{});
self.sleeping.store(true, .SeqCst);
}
defer if (timeout < 0) {
log.debug("waking from sleep", .{});
self.sleeping.store(false, .SeqCst);
};
switch (builtin.os.tag) {
// epoll
.linux => {