make sure that the async handle always gets closed

This commit is contained in:
Konstantin Käfer
2015-02-13 10:54:36 -08:00
parent 5d2ed0326e
commit aecef6da1a
3 changed files with 62 additions and 13 deletions

View File

@@ -22,7 +22,6 @@ class Request : private util::noncopyable {
public:
using Callback = std::function<void(const Response &)>;
Request(const Resource &resource, uv_loop_t *loop, Callback callback);
~Request();
public:
// May be called from any thread.
@@ -33,6 +32,8 @@ public:
void cancel();
private:
~Request();
void invoke();
static void notifyCallback(uv_async_t *async);
static void cancelCallback(uv_async_t *async);