thread: getcpu

This commit is contained in:
Michele Caini 2023-05-19 14:44:33 +02:00
parent 8743dfc155
commit 06f084d4ba
2 changed files with 10 additions and 0 deletions

View File

@ -20,6 +20,10 @@ UVW_INLINE thread::type thread::self() noexcept {
return uv_thread_self();
}
UVW_INLINE int thread::getcpu() noexcept {
return uv_thread_getcpu();
}
UVW_INLINE bool thread::equal(const thread &tl, const thread &tr) noexcept {
return !(0 == uv_thread_equal(tl.raw(), tr.raw()));
}

View File

@ -60,6 +60,12 @@ public:
*/
static type self() noexcept;
/**
* @brief Gets the CPU number on which the calling thread is running.
* @return The CPU number on which the calling thread is running.
*/
static int getcpu() noexcept;
/**
* @brief Compares thread by means of their identifiers.
* @param tl A valid instance of a thread.