concurrent(Args&&... args) : _worker(std::forward<Args>(args)...) , _done(false) , _thd([ = ]{concurrent_helper::Callback call; while (!_done) { _q.wait_and_pop(call); call(); }}) { }
void run() const { concurrent_helper::Callback call; while (!_done) { _q.wait_and_pop(call); call(); } }
/** * Moves in a unique_ptr<T> to be the background object. Starts up the worker thread * @param worker to act as the background object */ concurrent(std::unique_ptr<T> worker) : _worker(std::move(worker)) , _done(false) , _thd([ = ] { concurrent_helper::Callback call; while (_worker && !_done) { _q.wait_and_pop(call); call(); } }) { }