New Async wrapper.
This commit is contained in:
parent
6860450147
commit
87b4d97798
7 changed files with 157 additions and 37 deletions
|
@ -27,9 +27,9 @@
|
|||
|
||||
#include "crypto/rx/RxQueue.h"
|
||||
#include "backend/common/interfaces/IRxListener.h"
|
||||
#include "base/io/Async.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/tools/Handle.h"
|
||||
#include "crypto/rx/RxBasicStorage.h"
|
||||
|
||||
|
||||
|
@ -41,11 +41,7 @@
|
|||
xmrig::RxQueue::RxQueue(IRxListener *listener) :
|
||||
m_listener(listener)
|
||||
{
|
||||
m_async = new uv_async_t;
|
||||
m_async->data = this;
|
||||
|
||||
uv_async_init(uv_default_loop(), m_async, [](uv_async_t *handle) { static_cast<RxQueue *>(handle->data)->onReady(); });
|
||||
|
||||
m_async = std::make_shared<Async>(this);
|
||||
m_thread = std::thread(&RxQueue::backgroundInit, this);
|
||||
}
|
||||
|
||||
|
@ -61,8 +57,6 @@ xmrig::RxQueue::~RxQueue()
|
|||
m_thread.join();
|
||||
|
||||
delete m_storage;
|
||||
|
||||
Handle::close(m_async);
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,7 +161,7 @@ void xmrig::RxQueue::backgroundInit()
|
|||
}
|
||||
|
||||
m_state = STATE_IDLE;
|
||||
uv_async_send(m_async);
|
||||
m_async->send();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue