mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-28 01:49:23 -05:00
cmUVHandlePtr: Add uv_timer_ptr
This commit is contained in:
@@ -172,6 +172,18 @@ uv_pipe_ptr::operator uv_stream_t*() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||||
|
int uv_timer_ptr::init(uv_loop_t& loop, void* data)
|
||||||
|
{
|
||||||
|
allocate(data);
|
||||||
|
return uv_timer_init(&loop, *this);
|
||||||
|
}
|
||||||
|
|
||||||
|
int uv_timer_ptr::start(uv_timer_cb cb, uint64_t timeout, uint64_t repeat)
|
||||||
|
{
|
||||||
|
assert(handle);
|
||||||
|
return uv_timer_start(*this, cb, timeout, repeat);
|
||||||
|
}
|
||||||
|
|
||||||
uv_tty_ptr::operator uv_stream_t*() const
|
uv_tty_ptr::operator uv_stream_t*() const
|
||||||
{
|
{
|
||||||
return reinterpret_cast<uv_stream_t*>(handle.get());
|
return reinterpret_cast<uv_stream_t*>(handle.get());
|
||||||
@@ -199,6 +211,8 @@ UV_HANDLE_PTR_INSTANTIATE_EXPLICIT(stream)
|
|||||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||||
UV_HANDLE_PTR_INSTANTIATE_EXPLICIT(async)
|
UV_HANDLE_PTR_INSTANTIATE_EXPLICIT(async)
|
||||||
|
|
||||||
|
UV_HANDLE_PTR_INSTANTIATE_EXPLICIT(timer)
|
||||||
|
|
||||||
UV_HANDLE_PTR_INSTANTIATE_EXPLICIT(tty)
|
UV_HANDLE_PTR_INSTANTIATE_EXPLICIT(tty)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
@@ -164,6 +165,15 @@ struct uv_pipe_ptr : public uv_handle_ptr_<uv_pipe_t>
|
|||||||
int init(uv_loop_t& loop, int ipc, void* data = nullptr);
|
int init(uv_loop_t& loop, int ipc, void* data = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct uv_timer_ptr : public uv_handle_ptr_<uv_timer_t>
|
||||||
|
{
|
||||||
|
CM_PERFECT_FWD_CTOR(uv_timer_ptr, uv_handle_ptr_<uv_timer_t>);
|
||||||
|
|
||||||
|
int init(uv_loop_t& loop, void* data = nullptr);
|
||||||
|
|
||||||
|
int start(uv_timer_cb cb, uint64_t timeout, uint64_t repeat);
|
||||||
|
};
|
||||||
|
|
||||||
struct uv_tty_ptr : public uv_handle_ptr_<uv_tty_t>
|
struct uv_tty_ptr : public uv_handle_ptr_<uv_tty_t>
|
||||||
{
|
{
|
||||||
CM_PERFECT_FWD_CTOR(uv_tty_ptr, uv_handle_ptr_<uv_tty_t>);
|
CM_PERFECT_FWD_CTOR(uv_tty_ptr, uv_handle_ptr_<uv_tty_t>);
|
||||||
@@ -192,6 +202,8 @@ UV_HANDLE_PTR_INSTANTIATE_EXTERN(pipe)
|
|||||||
|
|
||||||
UV_HANDLE_PTR_INSTANTIATE_EXTERN(stream)
|
UV_HANDLE_PTR_INSTANTIATE_EXTERN(stream)
|
||||||
|
|
||||||
|
UV_HANDLE_PTR_INSTANTIATE_EXTERN(timer)
|
||||||
|
|
||||||
UV_HANDLE_PTR_INSTANTIATE_EXTERN(tty)
|
UV_HANDLE_PTR_INSTANTIATE_EXTERN(tty)
|
||||||
|
|
||||||
#undef UV_HANDLE_PTR_INSTANTIATE_EXTERN
|
#undef UV_HANDLE_PTR_INSTANTIATE_EXTERN
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ static bool testAllMoves()
|
|||||||
struct allTypes
|
struct allTypes
|
||||||
{
|
{
|
||||||
uv_stream_ptr _7;
|
uv_stream_ptr _7;
|
||||||
|
uv_timer_ptr _8;
|
||||||
uv_tty_ptr _9;
|
uv_tty_ptr _9;
|
||||||
uv_pipe_ptr _12;
|
uv_pipe_ptr _12;
|
||||||
uv_async_ptr _13;
|
uv_async_ptr _13;
|
||||||
|
|||||||
Reference in New Issue
Block a user