diff --git a/misc/main.cpp b/misc/main.cpp index 9715b37..8d0a688 100644 --- a/misc/main.cpp +++ b/misc/main.cpp @@ -67,7 +67,8 @@ int main(int argc, char **argv) { } }).run(); - uWS::Loop::defaultLoop()->free(); + /* This is needed to properly free default loop and such resources */ + uWS::destroy(); std::cout << "Everything fine, falling through" << std::endl; diff --git a/src/Loop.h b/src/Loop.h index a184c5d..ac19cdf 100644 --- a/src/Loop.h +++ b/src/Loop.h @@ -145,6 +145,11 @@ inline void run() { Loop::defaultLoop()->run(); } +/* Helper to clean up a thead before exiting */ +inline void destroy() { + Loop::defaultLoop()->free(); +} + } #endif // LOOP_H