Execute the next function from the queue, if any. Returns true if a function was executed, and false if the queue was empty.
| 70 | // Execute the next function from the queue, if any. Returns true if a |
| 71 | // function was executed, and false if the queue was empty. |
| 72 | bool execute_next(std::unique_lock<std::mutex>& lock) |
| 73 | { |
| 74 | if (queue_.empty()) |
| 75 | return false; |
| 76 | auto p(queue_.front()); |
| 77 | queue_.pop(); |
| 78 | lock.unlock(); |
| 79 | execute(lock, p); |
| 80 | return true; |
| 81 | } |
| 82 | |
| 83 | // Execute a function and decrement the outstanding work. |
| 84 | void execute(std::unique_lock<std::mutex>& lock, |