You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FYI: I am using uWS in visual studio in a windows environment.
I was able to dig through issues and find how to stop listening so that the event loop can finish its work and attempt to exit. Ultimately leading to the application exiting.
For me, when the loop was trying to free its self using Loop::get()->free() it was actually causing another loop to be spawned (the call to get() didn't return the previously instantiated loop), then when trying to free the SECOND loop things went haywire.
Apparently the thead context for std::atexit is not as you expected in windows OS.
Anyways its a (seemingly) easy fix, remove the call to Loop::get() in the atexit lambda:
static Loop *get(void *existingNativeLoop = nullptr) {
static thread_local Loop *lazyLoop = nullptr;
if (!lazyLoop) {
/* If we are given a native loop pointer we pass that to uSockets and let it deal with it */
if (existingNativeLoop) {
/* Todo: here we want to pass the pointer, not a boolean */
lazyLoop = create(true);
/* We cannot register automatic free here, must be manually done */
} else {
lazyLoop = create(false);
std::atexit([]() {
if(lazyLoop)
lazyLoop->free();
});
}
}
return lazyLoop;
}
The text was updated successfully, but these errors were encountered:
FYI: I am using uWS in visual studio in a windows environment.
I was able to dig through issues and find how to stop listening so that the event loop can finish its work and attempt to exit. Ultimately leading to the application exiting.
For me, when the loop was trying to free its self using
Loop::get()->free()
it was actually causing another loop to be spawned (the call to get() didn't return the previously instantiated loop), then when trying to free the SECOND loop things went haywire.Apparently the thead context for std::atexit is not as you expected in windows OS.
Anyways its a (seemingly) easy fix, remove the call to Loop::get() in the atexit lambda:
The text was updated successfully, but these errors were encountered: