Cleanup
This commit is contained in:
parent
109c088e8a
commit
1acd88ed39
15 changed files with 135 additions and 101 deletions
|
@ -7,8 +7,8 @@
|
|||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018-2019 tevador <tevador@gmail.com>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,11 +26,11 @@
|
|||
|
||||
|
||||
#include "crypto/rx/RxQueue.h"
|
||||
#include "backend/common/Tags.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "crypto/rx/RxBasicStorage.h"
|
||||
#include "base/tools/Handle.h"
|
||||
#include "backend/common/interfaces/IRxListener.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/tools/Handle.h"
|
||||
#include "crypto/rx/RxBasicStorage.h"
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_HWLOC
|
||||
|
@ -66,14 +66,6 @@ xmrig::RxQueue::~RxQueue()
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::RxQueue::isReady(const Job &job)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
return isReadyUnsafe(job);
|
||||
}
|
||||
|
||||
|
||||
xmrig::RxDataset *xmrig::RxQueue::dataset(const Job &job, uint32_t nodeId)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
@ -94,6 +86,15 @@ xmrig::HugePagesInfo xmrig::RxQueue::hugePages()
|
|||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
bool xmrig::RxQueue::isReady(const T &seed)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
return isReadyUnsafe(seed);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::RxQueue::enqueue(const RxSeed &seed, const std::vector<uint32_t> &nodeset, uint32_t threads, bool hugePages, bool oneGbPages, RxConfig::Mode mode, int priority)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
|
@ -124,9 +125,10 @@ void xmrig::RxQueue::enqueue(const RxSeed &seed, const std::vector<uint32_t> &no
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::RxQueue::isReadyUnsafe(const Job &job) const
|
||||
template<typename T>
|
||||
bool xmrig::RxQueue::isReadyUnsafe(const T &seed) const
|
||||
{
|
||||
return m_storage != nullptr && m_storage->isAllocated() && m_state == STATE_IDLE && m_seed == job;
|
||||
return m_storage != nullptr && m_storage->isAllocated() && m_state == STATE_IDLE && m_seed == seed;
|
||||
}
|
||||
|
||||
|
||||
|
@ -149,7 +151,7 @@ void xmrig::RxQueue::backgroundInit()
|
|||
lock.unlock();
|
||||
|
||||
LOG_INFO("%s" MAGENTA_BOLD("init dataset%s") " algo " WHITE_BOLD("%s (") CYAN_BOLD("%u") WHITE_BOLD(" threads)") BLACK_BOLD(" seed %s..."),
|
||||
rx_tag(),
|
||||
Tags::randomx(),
|
||||
item.nodeset.size() > 1 ? "s" : "",
|
||||
item.seed.algorithm().shortName(),
|
||||
item.threads,
|
||||
|
@ -180,3 +182,13 @@ void xmrig::RxQueue::onReady()
|
|||
m_listener->onDatasetReady();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
template bool RxQueue::isReady(const Job &);
|
||||
template bool RxQueue::isReady(const RxSeed &);
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue