From 947596ea5ea3ebb19323ccc2ae886e414b97e1d7 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 22 Apr 2022 12:15:15 -0700 Subject: [PATCH] clean up some of the libuv interations --- src/App.zig | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/App.zig b/src/App.zig index a6c71d0d0..1fbc9591e 100644 --- a/src/App.zig +++ b/src/App.zig @@ -57,7 +57,12 @@ pub fn run(self: App) !void { }).callback); defer embed.deinit(self.alloc); try embed.start(); - errdefer embed.stop(); + + // Notify the embedder to stop. We purposely do NOT wait for `join` + // here because handles with long timeouts may cause this to take a long + // time. We're exiting the app anyways if we're here so we let the OS + // clean up the threads. + defer embed.stop(); // We need at least one handle in the event loop at all times so // that the loop doesn't spin 100% CPU. @@ -81,10 +86,4 @@ pub fn run(self: App) !void { // CLose our timer so that we can cleanly close the loop. timer.close(null); _ = try self.loop.run(.default); - - // Notify the embedder to stop. We purposely do NOT wait for `join` - // here because handles with long timeouts may cause this to take a long - // time. We're exiting the app anyways if we're here so we let the OS - // clean up the threads. - embed.stop(); }