* Wait in the threadpool for this task to be ready. */
| 180 | * Wait in the threadpool for this task to be ready. |
| 181 | */ |
| 182 | Status wait() { |
| 183 | if (tp_ == nullptr) { |
| 184 | throw std::runtime_error("Cannot wait, threadpool is not initialized."); |
| 185 | } else if (!f_.valid()) { |
| 186 | throw std::runtime_error("Cannot wait, shared task is invalid."); |
| 187 | } else { |
| 188 | return tp_->wait(*this); |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * Is this task valid. Wait can only be called on vaid tasks. |