| 538 | |
| 539 | template <typename T> |
| 540 | Future<Nothing> handler(const T& data) |
| 541 | { |
| 542 | count++; |
| 543 | if (count >= repeat) { |
| 544 | promise->set(Nothing()); |
| 545 | return Nothing(); |
| 546 | } |
| 547 | |
| 548 | // NOTE: The prefix `this->` is required here, otherwise it will |
| 549 | // not compile when permissiveness is disabled (e.g. with MSVC on |
| 550 | // Windows). |
| 551 | dispatch(this->self(), &Self::_handler).then( |
| 552 | defer(this->self(), &Self::handler<T>, data)); |
| 553 | |
| 554 | return Nothing(); |
| 555 | } |
| 556 | |
| 557 | template <typename T> |
| 558 | static void run(const string& name, long repeats) |