EventLoop::~EventLoop() { uv_ref((uv_handle_t*) &deleteObjectsHandle); uv_prepare_stop(&deleteObjectsHandle); uv_close((uv_handle_t*) &deleteObjectsHandle, nullptr); // Wait remaining handle to close uv_run(&loop, UV_RUN_DEFAULT); if(uv_loop_alive(&loop)) { log(LL_Warning, "Loop still used but delete requested, handles:\n"); uv_walk(&loop, [](uv_handle_t* handle, void* arg) { EventLoop* self = (EventLoop*) arg; const char* type; switch(handle->type) { #define X(uc, lc) \ case UV_##uc: \ type = #lc; \ break; UV_HANDLE_TYPE_MAP(X) #undef X default: type = "<unknown>"; } self->log(LL_Warning, " [%08X] %s %p\n", handle->flags, type, handle); }, this);