Skip to content

Commit

Permalink
now working with libuv v1.26.x (close #146)
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed Feb 14, 2019
1 parent 7c043fa commit b269d9c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/in/deps.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
19 changes: 19 additions & 0 deletions src/uvw/thread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <memory>
#include <string>
#include <cstddef>
#include <type_traits>
#include <utility>
#include <uv.h>
Expand All @@ -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;
Expand All @@ -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;

Expand All @@ -55,6 +69,11 @@ class Thread final: public UnderlyingType<Thread, uv_thread_t> {
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()));
}
Expand Down

0 comments on commit b269d9c

Please sign in to comment.