mirror of
https://github.com/xmrig/xmrig.git
synced 2026-01-23 23:02:51 -05:00
Add Workers class.
This commit is contained in:
25
src/App.cpp
25
src/App.cpp
@@ -35,8 +35,7 @@
|
||||
#include "Options.h"
|
||||
#include "Summary.h"
|
||||
#include "version.h"
|
||||
#include "workers/Handle.h"
|
||||
#include "workers/SingleWorker.h"
|
||||
#include "workers/Workers.h"
|
||||
|
||||
|
||||
|
||||
@@ -75,7 +74,7 @@ App::exec()
|
||||
Mem::allocate(m_options->algo(), m_options->threads(), m_options->doubleHash());
|
||||
Summary::print();
|
||||
|
||||
startWorders();
|
||||
Workers::start(m_options->threads());
|
||||
|
||||
m_network->connect();
|
||||
|
||||
@@ -84,23 +83,3 @@ App::exec()
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
void App::startWorders()
|
||||
{
|
||||
for (int i = 0; i < m_options->threads(); ++i) {
|
||||
Handle *handle = new Handle(i);
|
||||
m_workers.push_back(handle);
|
||||
handle->start(App::onWorkerStarted);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *App::onWorkerStarted(void *arg)
|
||||
{
|
||||
auto handle = static_cast<Handle*>(arg);
|
||||
IWorker *worker = new SingleWorker(handle);
|
||||
worker->start();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user