Removed CPU specific code from Worker class.

This commit is contained in:
XMRig 2019-07-14 00:35:38 +07:00
parent ee434a5708
commit dff59fabc2
7 changed files with 39 additions and 44 deletions

View file

@ -34,6 +34,7 @@
#include "crypto/rx/RxVm.h"
#include "net/JobResults.h"
#include "workers/CpuThreadLegacy.h"
#include "workers/ThreadHandle.h"
#include "workers/Workers.h"
@ -45,8 +46,9 @@ static constexpr uint32_t kReserveCount = 4096;
template<size_t N>
xmrig::CpuWorker<N>::CpuWorker(ThreadHandle *handle)
: Worker(handle)
xmrig::CpuWorker<N>::CpuWorker(ThreadHandle *handle) :
Worker(handle->threadId(), handle->config()->affinity(), handle->config()->priority()),
m_thread(static_cast<xmrig::CpuThreadLegacy *>(handle->config()))
{
if (m_thread->algorithm().family() != Algorithm::RANDOM_X) {
m_memory = Mem::create(m_ctx, m_thread->algorithm(), N);

View file

@ -34,9 +34,13 @@
#include "backend/common/Worker.h"
class ThreadHandle;
namespace xmrig {
class CpuThreadLegacy;
class RxVm;
@ -47,6 +51,8 @@ public:
CpuWorker(ThreadHandle *handle);
~CpuWorker() override;
inline const MemInfo &memory() const { return m_memory; }
protected:
bool selfTest() override;
void start() override;
@ -60,9 +66,10 @@ private:
bool verify2(const Algorithm &algorithm, const uint8_t *referenceValue);
void consumeJob();
CpuThreadLegacy *m_thread;
cryptonight_ctx *m_ctx[N];
MemInfo m_memory;
uint8_t m_hash[N * 32];
WorkerJob<N> m_job;
# ifdef XMRIG_ALGO_RANDOMX