commit
d0898aadca
4 changed files with 6 additions and 9 deletions
|
@ -57,9 +57,4 @@ void xmrig::App::background()
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
LOG_ERR("setsid() failed (errno = %d)", errno);
|
LOG_ERR("setsid() failed (errno = %d)", errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
i = chdir("/");
|
|
||||||
if (i < 0) {
|
|
||||||
LOG_ERR("chdir() failed (errno = %d)", errno);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
#include "workers/Handle.h"
|
#include "workers/Handle.h"
|
||||||
|
|
||||||
|
|
||||||
Handle::Handle(xmrig::Config *config, xmrig::HasherConfig *hasherConfig, uint32_t offset) :
|
Handle::Handle(int id, xmrig::Config *config, xmrig::HasherConfig *hasherConfig, uint32_t offset) :
|
||||||
|
m_id(id),
|
||||||
m_offset(offset),
|
m_offset(offset),
|
||||||
m_config(config),
|
m_config(config),
|
||||||
m_hasherConfig(hasherConfig),
|
m_hasherConfig(hasherConfig),
|
||||||
|
|
|
@ -41,7 +41,7 @@ class IWorker;
|
||||||
class Handle
|
class Handle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Handle(xmrig::Config *config, xmrig::HasherConfig *hasherConfig, uint32_t offset);
|
Handle(int id, xmrig::Config *config, xmrig::HasherConfig *hasherConfig, uint32_t offset);
|
||||||
|
|
||||||
struct HandleArg {
|
struct HandleArg {
|
||||||
Handle *handle;
|
Handle *handle;
|
||||||
|
@ -52,7 +52,7 @@ public:
|
||||||
void start(void (*callback) (void *));
|
void start(void (*callback) (void *));
|
||||||
|
|
||||||
inline std::vector<IWorker *> &workers() { return m_workers; }
|
inline std::vector<IWorker *> &workers() { return m_workers; }
|
||||||
inline size_t hasherId() const { return m_hasherConfig->index(); }
|
inline size_t hasherId() const { return m_id; }
|
||||||
inline size_t parallelism(int workerIdx) const { return m_hasher != nullptr ? m_hasher->parallelism(workerIdx) : 0; }
|
inline size_t parallelism(int workerIdx) const { return m_hasher != nullptr ? m_hasher->parallelism(workerIdx) : 0; }
|
||||||
inline size_t computingThreads() const { return m_hasher != nullptr ? m_hasher->computingThreads() : 0; }
|
inline size_t computingThreads() const { return m_hasher != nullptr ? m_hasher->computingThreads() : 0; }
|
||||||
inline uint32_t offset() const { return m_offset; }
|
inline uint32_t offset() const { return m_offset; }
|
||||||
|
@ -61,6 +61,7 @@ public:
|
||||||
inline Hasher *hasher() const { return m_hasher; }
|
inline Hasher *hasher() const { return m_hasher; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int m_id;
|
||||||
std::vector<uv_thread_t> m_threads;
|
std::vector<uv_thread_t> m_threads;
|
||||||
std::vector<IWorker *> m_workers;
|
std::vector<IWorker *> m_workers;
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ bool Workers::start(xmrig::Controller *controller)
|
||||||
uint32_t offset = 0;
|
uint32_t offset = 0;
|
||||||
|
|
||||||
for (xmrig::HasherConfig *hasherConfig : hashers) {
|
for (xmrig::HasherConfig *hasherConfig : hashers) {
|
||||||
Handle *handle = new Handle(controller->config(), hasherConfig, offset);
|
Handle *handle = new Handle((int)(m_workers.size()), controller->config(), hasherConfig, offset);
|
||||||
if(handle->hasher() != nullptr) {
|
if(handle->hasher() != nullptr) {
|
||||||
offset += handle->computingThreads();
|
offset += handle->computingThreads();
|
||||||
m_totalThreads += handle->computingThreads();
|
m_totalThreads += handle->computingThreads();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue