now working with libuv v1.23.x
This commit is contained in:
parent
bd520c40ba
commit
857d652ddf
@ -16,7 +16,7 @@ endif()
|
||||
# Project configuration
|
||||
#
|
||||
|
||||
project(uvw VERSION 1.10.1)
|
||||
project(uvw VERSION 1.11.0)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
|
||||
@ -17,7 +17,7 @@ ExternalProject_Add(
|
||||
ExternalProject_Add(
|
||||
libuv
|
||||
GIT_REPOSITORY https://github.com/libuv/libuv.git
|
||||
GIT_TAG v1.22.0
|
||||
GIT_TAG v1.23.0
|
||||
SOURCE_DIR @LIBUV_DEPS_DIR@
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
|
||||
@ -47,9 +47,9 @@ enum class UVFsType: std::underlying_type_t<uv_fs_type> {
|
||||
READLINK = UV_FS_READLINK,
|
||||
CHOWN = UV_FS_CHOWN,
|
||||
FCHOWN = UV_FS_FCHOWN,
|
||||
LCHOWN = UV_FS_LCHOWN,
|
||||
REALPATH = UV_FS_REALPATH,
|
||||
COPYFILE = UV_FS_COPYFILE
|
||||
COPYFILE = UV_FS_COPYFILE,
|
||||
LCHOWN = UV_FS_LCHOWN
|
||||
};
|
||||
|
||||
|
||||
@ -140,9 +140,9 @@ enum class UVSymLinkFlags: int {
|
||||
* * `FsRequest::Type::READLINK`
|
||||
* * `FsRequest::Type::CHOWN`
|
||||
* * `FsRequest::Type::FCHOWN`
|
||||
* * `FsRequest::Type::LCHOWN`
|
||||
* * `FsRequest::Type::REALPATH`
|
||||
* * `FsRequest::Type::COPYFILE`
|
||||
* * `FsRequest::Type::LCHOWN`
|
||||
*
|
||||
* It will be emitted by FsReq and/or FileReq according with their
|
||||
* functionalities.
|
||||
@ -797,20 +797,6 @@ public:
|
||||
return !(req->result < 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the OS dependent handle.
|
||||
*
|
||||
* For a file descriptor in the C runtime, get the OS-dependent handle. On
|
||||
* UNIX, returns the file descriptor as-is. On Windows, this calls a system
|
||||
* function.<br/>
|
||||
* Note that the return value is still owned by the C runtime, any attempts
|
||||
* to close it or to use it after closing the file descriptor may lead to
|
||||
* malfunction.
|
||||
*/
|
||||
OSFileDescriptor handle() const noexcept {
|
||||
return uv_get_osfhandle(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cast operator to FileHandle.
|
||||
*
|
||||
@ -1427,4 +1413,36 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/*! @brief Helper functions. */
|
||||
struct FsHelper {
|
||||
/**
|
||||
* @brief Gets the OS dependent handle.
|
||||
*
|
||||
* For a file descriptor in the C runtime, get the OS-dependent handle. On
|
||||
* UNIX, returns the file descriptor as-is. On Windows, this calls a system
|
||||
* function.<br/>
|
||||
* Note that the return value is still owned by the C runtime, any attempts
|
||||
* to close it or to use it after closing the file descriptor may lead to
|
||||
* malfunction.
|
||||
*/
|
||||
static OSFileDescriptor handle(FileHandle file) noexcept {
|
||||
return uv_get_osfhandle(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the file descriptor.
|
||||
*
|
||||
* For a OS-dependent handle, get the file descriptor in the C runtime. On
|
||||
* UNIX, returns the file descriptor as-is. On Windows, this calls a system
|
||||
* function.<br/>
|
||||
* Note that the return value is still owned by the C runtime, any attempts
|
||||
* to close it or to use it after closing the handle may lead to
|
||||
* malfunction.
|
||||
*/
|
||||
static FileHandle open(OSFileDescriptor descriptor) noexcept {
|
||||
return uv_open_osfhandle(descriptor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -29,8 +29,9 @@ struct IdleEvent {};
|
||||
* idle handles, the loop will perform a zero timeout poll instead of blocking
|
||||
* for I/O.
|
||||
*
|
||||
* **Note**: despite the name, idle handles will emit events on every loop
|
||||
* iteration, not when the loop is actually _idle_.
|
||||
* @note
|
||||
* Despite the name, idle handles will emit events on every loop iteration, not
|
||||
* when the loop is actually _idle_.
|
||||
*
|
||||
* To create an `IdleHandle` through a `Loop`, no arguments are required.
|
||||
*/
|
||||
|
||||
@ -212,7 +212,8 @@ public:
|
||||
* it more than once, it may fail.<br/>
|
||||
* It is suggested to only call this function once per ListenEvent event.
|
||||
*
|
||||
* **Note**: both the handles must be running on the same loop.
|
||||
* @note
|
||||
* Both the handles must be running on the same loop.
|
||||
*
|
||||
* @param ref An initialized handle to be used to accept the connection.
|
||||
*/
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
#include <utility>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <array>
|
||||
#include <uv.h>
|
||||
|
||||
@ -544,6 +545,48 @@ struct Utilities {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Retrieves the scheduling priority of a process.
|
||||
*
|
||||
* The returned value is between -20 (high priority) and 19 (low priority).
|
||||
* A value that is out of range is returned in case of errors.
|
||||
*
|
||||
* @note
|
||||
* On Windows, the result won't equal necessarily the exact value of the
|
||||
* priority because of a mapping to a Windows priority class.
|
||||
*
|
||||
* @param pid A valid process id.
|
||||
* @return The scheduling priority of the process.
|
||||
*/
|
||||
static int osPriority(PidType pid) {
|
||||
int prio = 0;
|
||||
|
||||
if(uv_os_getpriority(pid, &prio)) {
|
||||
prio = UV_PRIORITY_LOW + 1;
|
||||
}
|
||||
|
||||
return prio;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the scheduling priority of a process.
|
||||
*
|
||||
* The returned value range is between -20 (high priority) and 19 (low
|
||||
* priority).
|
||||
*
|
||||
* @note
|
||||
* On Windows, the priority is mapped to a Windows priority class. When
|
||||
* retrieving the process priority, the result won't equal necessarily the
|
||||
* exact value of the priority.
|
||||
*
|
||||
* @param pid A valid process id.
|
||||
* @param prio The scheduling priority to set to the process.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
static bool osPriority(PidType pid, int prio) {
|
||||
return 0 == uv_os_setpriority(pid, prio);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the type of the handle given a category.
|
||||
* @param category A properly initialized handle category.
|
||||
@ -719,10 +762,11 @@ struct Utilities {
|
||||
*
|
||||
* If any of the function pointers is _null_, the invokation will fail.
|
||||
*
|
||||
* **Note**: there is no protection against changing the allocator multiple
|
||||
* times. If the user changes it they are responsible for making sure the
|
||||
* allocator is changed while no memory was allocated with the previous
|
||||
* allocator, or that they are compatible.
|
||||
* @note
|
||||
* There is no protection against changing the allocator multiple times. If
|
||||
* the user changes it they are responsible for making sure the allocator is
|
||||
* changed while no memory was allocated with the previous allocator, or
|
||||
* that they are compatible.
|
||||
*
|
||||
* @param mallocFunc Replacement function for _malloc_.
|
||||
* @param reallocFunc Replacement function for _realloc_.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user