Пример #1
0
 concurrent(Args&&... args)
 : _worker(std::forward<Args>(args)...)
 , _done(false)
 , _thd([ = ]{concurrent_helper::Callback call;
    while (!_done) {  _q.wait_and_pop(call);  call();
    }}) {
 }
Пример #2
0
 void run() const {
    concurrent_helper::Callback call;
    while (!_done) { 
       _q.wait_and_pop(call);
       call();
    }
 }
Пример #3
0
   /**
    * 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();
      }
   }) {
   }