Remove uWS::destroy()
This commit is contained in:
@@ -35,7 +35,4 @@ int main() {
|
|||||||
std::cout << "Listening on port " << 9001 << std::endl;
|
std::cout << "Listening on port " << 9001 << std::endl;
|
||||||
}
|
}
|
||||||
}).run();
|
}).run();
|
||||||
|
|
||||||
/* This is needed to properly clear everything */
|
|
||||||
uWS::destroy();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,4 @@ int main() {
|
|||||||
}).run();
|
}).run();
|
||||||
|
|
||||||
std::cout << "Failed to listen on port 3000" << std::endl;
|
std::cout << "Failed to listen on port 3000" << std::endl;
|
||||||
|
|
||||||
/* This is needed to properly clear everything */
|
|
||||||
uWS::destroy();
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-5
@@ -84,6 +84,9 @@ public:
|
|||||||
if (!defaultLoop) {
|
if (!defaultLoop) {
|
||||||
ownsDefaultLoop = true;
|
ownsDefaultLoop = true;
|
||||||
defaultLoop = create(true);
|
defaultLoop = create(true);
|
||||||
|
std::atexit([]() {
|
||||||
|
Loop::defaultLoop()->free();
|
||||||
|
});
|
||||||
return defaultLoop;
|
return defaultLoop;
|
||||||
} else if (ownsDefaultLoop) {
|
} else if (ownsDefaultLoop) {
|
||||||
return defaultLoop;
|
return defaultLoop;
|
||||||
@@ -145,11 +148,6 @@ inline void run() {
|
|||||||
Loop::defaultLoop()->run();
|
Loop::defaultLoop()->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper to clean up a thead before exiting */
|
|
||||||
inline void destroy() {
|
|
||||||
Loop::defaultLoop()->free();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // LOOP_H
|
#endif // LOOP_H
|
||||||
|
|||||||
Reference in New Issue
Block a user