retain the uv loop until all things deconstructed

fixes #261
This commit is contained in:
Konstantin Käfer
2014-05-30 17:32:09 +02:00
parent 78fda8bb62
commit d5e63cea21
8 changed files with 44 additions and 26 deletions

View File

@@ -1,13 +1,13 @@
#include <llmr/platform/request.hpp>
#include <llmr/platform/platform.hpp>
#include <llmr/util/std.hpp>
#include <uv.h>
#include <llmr/util/uv.hpp>
using namespace llmr::platform;
Request::Request(const std::string &url,
std::function<void(Response *)> callback,
uv_loop_t *loop)
std::shared_ptr<uv::loop> loop)
: url(url),
res(std::make_unique<Response>(callback)),
cancelled(false),
@@ -20,7 +20,7 @@ Request::Request(const std::string &url,
// create an actual work request that is attached to the default loop.
async = new uv_async_t();
async->data = new std::unique_ptr<Response>();
uv_async_init(loop, async, complete);
uv_async_init(**loop, async, complete);
}
}