Benchmark refactoring, zero delay submit and unified HTTP layer.
This commit is contained in:
parent
be8245fc92
commit
c1d99bfa09
21 changed files with 558 additions and 380 deletions
|
@ -119,6 +119,7 @@ namespace xmrig {
|
|||
class AsyncPrivate
|
||||
{
|
||||
public:
|
||||
Async::Callback callback;
|
||||
IAsyncListener *listener = nullptr;
|
||||
uv_async_t *async = nullptr;
|
||||
};
|
||||
|
@ -127,6 +128,16 @@ public:
|
|||
} // namespace xmrig
|
||||
|
||||
|
||||
xmrig::Async::Async(Callback callback) : d_ptr(new AsyncPrivate())
|
||||
{
|
||||
d_ptr->callback = std::move(callback);
|
||||
d_ptr->async = new uv_async_t;
|
||||
d_ptr->async->data = this;
|
||||
|
||||
uv_async_init(uv_default_loop(), d_ptr->async, [](uv_async_t *handle) { static_cast<Async *>(handle->data)->d_ptr->callback(); });
|
||||
}
|
||||
|
||||
|
||||
xmrig::Async::Async(IAsyncListener *listener) : d_ptr(new AsyncPrivate())
|
||||
{
|
||||
d_ptr->listener = listener;
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
#include <functional>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
|
@ -37,6 +40,9 @@ class Async
|
|||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Async)
|
||||
|
||||
using Callback = std::function<void()>;
|
||||
|
||||
Async(Callback callback);
|
||||
Async(IAsyncListener *listener);
|
||||
~Async();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue