Added uv_cond_init_checked

This commit is contained in:
SChernykh 2022-07-14 09:02:08 +02:00
parent 945de348f3
commit 4733f46a28
3 changed files with 11 additions and 5 deletions

View file

@ -389,11 +389,7 @@ RandomX_Hasher_RPC::RandomX_Hasher_RPC(p2pool* pool)
uv_mutex_init_checked(&m_requestMutex);
uv_mutex_init_checked(&m_condMutex);
err = uv_cond_init(&m_cond);
if (err) {
LOGERR(1, "failed to create cond, error " << uv_err_name(err));
panic();
}
uv_cond_init_checked(&m_cond);
err = uv_thread_create(&m_loopThread, loop, this);
if (err) {

View file

@ -205,6 +205,15 @@ std::istream& operator>>(std::istream& s, hash& h)
return s;
}
void uv_cond_init_checked(uv_cond_t* cond)
{
const int result = uv_cond_init(cond);
if (result) {
LOGERR(1, "failed to create conditional variable, error " << uv_err_name(result));
panic();
}
}
void uv_mutex_init_checked(uv_mutex_t* mutex)
{
const int result = uv_mutex_init(mutex);

View file

@ -57,6 +57,7 @@ private:
typedef RWLock<true> WriteLock;
void uv_cond_init_checked(uv_cond_t* cond);
void uv_mutex_init_checked(uv_mutex_t* mutex);
void uv_rwlock_init_checked(uv_rwlock_t* lock);
uv_loop_t* uv_default_loop_checked();