示例#1
0
文件: main.cpp 项目: CCJY/coliru
 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
文件: main.cpp 项目: CCJY/coliru
 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();
      }
   }) {
   }