MCPcopy Create free account
hub / github.com/apache/brpc / add_with_suspend3

Function add_with_suspend3

test/bthread_execution_queue_unittest.cpp:855–874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

853}
854
855int add_with_suspend3(void* meta, bthread::TaskIterator<LongIntTask>& iter) {
856 int64_t* result = (int64_t*)meta;
857 if (iter.is_queue_stopped()) {
858 stopped = true;
859 return 0;
860 }
861 for (; iter; ++iter) {
862 if (iter->value == -100) {
863 g_suspending = true;
864 while (g_suspending) {
865 usleep(10);
866 }
867 if (iter->event) { iter->event->signal(); }
868 } else {
869 *result += iter->value;
870 if (iter->event) { iter->event->signal(); }
871 }
872 }
873 return 0;
874}
875
876void test_cancel_unexecuted_high_priority_task(bool use_pthread) {
877 g_should_be_urgent = false;

Callers

nothing calls this directly

Calls 2

is_queue_stoppedMethod · 0.80
signalMethod · 0.80

Tested by

no test coverage detected