diff --git a/redGrapes/dispatch/thread/worker.cpp b/redGrapes/dispatch/thread/worker.cpp index 9445e27f..49ddb4aa 100644 --- a/redGrapes/dispatch/thread/worker.cpp +++ b/redGrapes/dispatch/thread/worker.cpp @@ -32,7 +32,6 @@ WorkerThread::~WorkerThread() void WorkerThread::start() { thread = std::thread([this]{ this->run(); }); - this->Worker::start(); } Worker::Worker( memory::ChunkedBumpAlloc & alloc, HwlocContext & hwloc_ctx, hwloc_obj_t const & obj, WorkerId worker_id ) @@ -46,12 +45,6 @@ Worker::~Worker() { } -void Worker::start() -{ - m_start.store(true, std::memory_order_release); - wake(); -} - void Worker::stop() { SPDLOG_TRACE("Worker::stop()"); @@ -83,12 +76,6 @@ void WorkerThread::run() }; */ - /* wait for start-flag to be triggerd in order - * to avoid premature access to `shared_from_this` - */ - while( ! m_start.load(std::memory_order_consume) ) - cv.wait(); - /* initialize thread-local variables */ SingletonContext::get().current_worker = this->shared_from_this(); diff --git a/redGrapes/dispatch/thread/worker.hpp b/redGrapes/dispatch/thread/worker.hpp index 10684cb1..e4b02dec 100644 --- a/redGrapes/dispatch/thread/worker.hpp +++ b/redGrapes/dispatch/thread/worker.hpp @@ -44,13 +44,6 @@ struct Worker //private: WorkerId id; - /*! - * if true, the thread shall start - * executing the jobs in its queue - * and request rescheduling if empty - */ - std::atomic_bool m_start{ false }; - /*! if true, the thread shall stop * instead of waiting when it is out of jobs */ @@ -78,7 +71,6 @@ struct Worker inline scheduler::WakerId get_waker_id() { return id + 1; } inline bool wake() { return cv.notify(); } - void start(); virtual void stop(); /* adds a new task to the emplacement queue @@ -127,13 +119,11 @@ struct WorkerThread WorkerThread( memory::ChunkedBumpAlloc & alloc, HwlocContext & hwloc_ctx, hwloc_obj_t const & obj, WorkerId worker_id ); ~WorkerThread(); - void start(); - void stop(); - /* function the thread will execute */ void run(); - + void stop(); + void cpubind(); void membind(); }; diff --git a/redGrapes/dispatch/thread/worker_pool.cpp b/redGrapes/dispatch/thread/worker_pool.cpp index 920916c9..1af5219d 100644 --- a/redGrapes/dispatch/thread/worker_pool.cpp +++ b/redGrapes/dispatch/thread/worker_pool.cpp @@ -58,12 +58,6 @@ WorkerPool::~WorkerPool() { } -void WorkerPool::start() -{ - for( auto & worker : workers ) - worker->start(); -} - void WorkerPool::stop() { for( auto & worker : workers ) diff --git a/redGrapes/dispatch/thread/worker_pool.hpp b/redGrapes/dispatch/thread/worker_pool.hpp index 38b20b15..95d1a147 100644 --- a/redGrapes/dispatch/thread/worker_pool.hpp +++ b/redGrapes/dispatch/thread/worker_pool.hpp @@ -42,10 +42,6 @@ struct WorkerPool return workers.size(); } - /* signals all workers to start executing tasks - */ - void start(); - /* signals all workers that no new tasks will be added */ void stop(); diff --git a/redGrapes/redGrapes.cpp b/redGrapes/redGrapes.cpp index 53a3aad3..d6a41300 100644 --- a/redGrapes/redGrapes.cpp +++ b/redGrapes/redGrapes.cpp @@ -125,12 +125,10 @@ void Context::init( size_t n_workers, std::shared_ptr sch this->n_workers = n_workers; worker_pool = std::make_shared( hwloc_ctx, n_workers ); - worker_pool->emplace_workers( n_workers ); - root_space = std::make_shared(); this->scheduler = scheduler; - worker_pool->start(); + worker_pool->emplace_workers( n_workers ); } void Context::init( size_t n_workers )