| 183 | |
| 184 | template <typename T> |
| 185 | void GenericFuture<T>::wait() const |
| 186 | { |
| 187 | std::visit(Overloaded { |
| 188 | [](const ThreadContextPtr<T>& ctx) { |
| 189 | if (local::context()) { |
| 190 | cast::context<T>(ctx)->wait(local::context()); |
| 191 | } |
| 192 | else { |
| 193 | ctx->wait(); |
| 194 | } |
| 195 | }, |
| 196 | [](const ThreadFuturePtr<T>& ctx) { |
| 197 | if (local::context()) { |
| 198 | cast::context<T>(ctx)->wait(local::context()); |
| 199 | } |
| 200 | else { |
| 201 | ctx->wait(); |
| 202 | } |
| 203 | }, |
| 204 | [this](const CoroContextPtr<T>& ctx) { |
| 205 | if (local::context()) { |
| 206 | ctx->wait(_sync ? _sync : local::context()); |
| 207 | } |
| 208 | else { |
| 209 | cast::context<T>(ctx)->wait(); |
| 210 | } |
| 211 | }, |
| 212 | [this](const CoroFuturePtr<T>& ctx) { |
| 213 | if (local::context()) { |
| 214 | ctx->wait(_sync ? _sync : local::context()); |
| 215 | } |
| 216 | else { |
| 217 | cast::context<T>(ctx)->wait(); |
| 218 | } |
| 219 | } |
| 220 | }, _context); |
| 221 | } |
| 222 | |
| 223 | template <typename T> |
| 224 | std::future_status GenericFuture<T>::waitFor(std::chrono::milliseconds timeMs) const |
no test coverage detected