| 623 | } |
| 624 | |
| 625 | int add_with_suspend2(void* meta, bthread::TaskIterator<LongIntTask>& iter) { |
| 626 | int64_t* result = (int64_t*)meta; |
| 627 | if (iter.is_queue_stopped()) { |
| 628 | stopped = true; |
| 629 | return 0; |
| 630 | } |
| 631 | for (; iter; ++iter) { |
| 632 | if (iter->value == -100) { |
| 633 | g_suspending = true; |
| 634 | while (g_suspending) { |
| 635 | usleep(10); |
| 636 | } |
| 637 | if (iter->event) { iter->event->signal(); } |
| 638 | } else { |
| 639 | *result += iter->value; |
| 640 | if (iter->event) { iter->event->signal(); } |
| 641 | } |
| 642 | } |
| 643 | return 0; |
| 644 | } |
| 645 | |
| 646 | void test_cancel(bool use_pthread) { |
| 647 | bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to suppress warnings |
nothing calls this directly
no test coverage detected