* Wait in the threadpool for this task to be ready. */
| 107 | * Wait in the threadpool for this task to be ready. |
| 108 | */ |
| 109 | Status wait() { |
| 110 | if (tp_ == nullptr) { |
| 111 | throw std::runtime_error("Cannot wait, threadpool is not initialized."); |
| 112 | } else if (!f_.valid()) { |
| 113 | throw std::runtime_error("Cannot wait, task is invalid."); |
| 114 | } else { |
| 115 | return tp_->wait(*this); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Is this task valid. Wait can only be called on vaid tasks. |