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 configuration
# #
project(uvw VERSION 1.13.0) project(uvw VERSION 1.14.0)
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug) set(CMAKE_BUILD_TYPE Debug)

View File

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

View File

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

View File

@ -3,6 +3,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <cstddef>
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include <uv.h> #include <uv.h>
@ -13,6 +14,18 @@
namespace uvw { 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 Thread;
class ThreadLocalStorage; class ThreadLocalStorage;
class Once; class Once;
@ -32,6 +45,7 @@ class Thread final: public UnderlyingType<Thread, uv_thread_t> {
} }
public: public:
using Options = details::UVThreadCreateFlags;
using Task = InternalTask; using Task = InternalTask;
using Type = uv_thread_t; using Type = uv_thread_t;
@ -55,6 +69,11 @@ public:
return (0 == uv_thread_create(get(), &createCallback, this)); 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 { bool join() noexcept {
return (0 == uv_thread_join(get())); return (0 == uv_thread_join(get()));
} }