now working with libuv v1.26.x (close #146)

This commit is contained in:
Michele Caini 2019-02-14 22:38:34 +01:00
parent 7c043fae5e
commit b269d9cfa6
4 changed files with 22 additions and 3 deletions

View File

@ -16,7 +16,7 @@ endif()
# Project configuration
#
project(uvw VERSION 1.13.0)
project(uvw VERSION 1.14.0)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)

View File

@ -17,7 +17,7 @@ ExternalProject_Add(
ExternalProject_Add(
libuv
GIT_REPOSITORY https://github.com/libuv/libuv.git
GIT_TAG v1.25.0
GIT_TAG v1.26.0
SOURCE_DIR @LIBUV_DEPS_DIR@
CONFIGURE_COMMAND ""
BUILD_COMMAND ""

View File

@ -14,7 +14,7 @@ class UVMConan(ConanFile):
exports = "LICENSE"
exports_sources = "src/*"
no_copy_source = True
requires = "libuv/1.25.0@bincrafters/stable"
requires = "libuv/1.26.0@bincrafters/stable"
def package(self):
self.copy(pattern="LICENSE", dst="licenses")

View File

@ -3,6 +3,7 @@
#include <memory>
#include <string>
#include <cstddef>
#include <type_traits>
#include <utility>
#include <uv.h>
@ -13,6 +14,18 @@
namespace uvw {
namespace details {
enum class UVThreadCreateFlags: std::underlying_type_t<uv_thread_create_flags> {
THREAD_NO_FLAGS = UV_THREAD_NO_FLAGS,
THREAD_HAS_STACK_SIZE = UV_THREAD_HAS_STACK_SIZE
};
}
class Thread;
class ThreadLocalStorage;
class Once;
@ -32,6 +45,7 @@ class Thread final: public UnderlyingType<Thread, uv_thread_t> {
}
public:
using Options = details::UVThreadCreateFlags;
using Task = InternalTask;
using Type = uv_thread_t;
@ -55,6 +69,11 @@ public:
return (0 == uv_thread_create(get(), &createCallback, this));
}
bool run(Flags<Options> opts, std::size_t stack = {}) noexcept {
uv_thread_options_t params{opts, stack};
return (0 == uv_thread_create_ex(get(), &params, &createCallback, this));
}
bool join() noexcept {
return (0 == uv_thread_join(get()));
}