25
25
26
26
27
27
#include " api/Api.h"
28
+ #include " core/Config.h"
29
+ #include " core/Controller.h"
28
30
#include " interfaces/IJobResultListener.h"
31
+ #include " interfaces/IThread.h"
29
32
#include " Mem.h"
30
33
#include " workers/DoubleWorker.h"
31
34
#include " workers/Handle.h"
32
35
#include " workers/Hashrate.h"
33
36
#include " workers/SingleWorker.h"
34
37
#include " workers/Workers.h"
35
38
39
+ #include " log/Log.h"
40
+
36
41
37
42
bool Workers::m_active = false ;
38
43
bool Workers::m_enabled = true ;
@@ -104,8 +109,14 @@ void Workers::setJob(const Job &job, bool donate)
104
109
105
110
void Workers::start (int64_t affinity, int priority, xmrig::Controller *controller)
106
111
{
107
- const int threads = Mem::threads ();
108
- m_hashrate = new Hashrate (threads, controller);
112
+ const std::vector<xmrig::IThread *> &threads = controller->config ()->threads ();
113
+
114
+ size_t totalWays = 0 ;
115
+ for (const xmrig::IThread *thread : threads) {
116
+ totalWays += thread->multiway ();
117
+ }
118
+
119
+ m_hashrate = new Hashrate (threads.size (), controller);
109
120
110
121
uv_mutex_init (&m_mutex);
111
122
uv_rwlock_init (&m_rwlock);
@@ -117,8 +128,8 @@ void Workers::start(int64_t affinity, int priority, xmrig::Controller *controlle
117
128
uv_timer_init (uv_default_loop (), &m_timer);
118
129
uv_timer_start (&m_timer, Workers::onTick, 500 , 500 );
119
130
120
- for (int i = 0 ; i < threads; ++i ) {
121
- Handle *handle = new Handle (i, threads, affinity, priority );
131
+ for (xmrig::IThread *thread : threads) {
132
+ Handle *handle = new Handle (thread, totalWays );
122
133
m_workers.push_back (handle);
123
134
handle->start (Workers::onReady);
124
135
}
0 commit comments