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

Function test_cancel_self

test/bthread_execution_queue_unittest.cpp:699–717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

697}
698
699void test_cancel_self(bool use_pthread) {
700 bthread::ExecutionQueueId<CancelSelf*> queue_id = { 0 }; // to suppress warnings
701 bthread::ExecutionQueueOptions options;
702 options.use_pthread = use_pthread;
703 if (options.use_pthread) {
704 LOG(INFO) << "================ pthread ================";
705 } else {
706 LOG(INFO) << "================ bthread ================";
707 }
708 ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options,
709 cancel_self, NULL));
710 CancelSelf task;
711 task.handle = NULL;
712 bthread::TaskHandle handle;
713 ASSERT_EQ(0, bthread::execution_queue_execute(queue_id, &task, NULL, &handle));
714 task.handle.store(&handle);
715 ASSERT_EQ(0, bthread::execution_queue_stop(queue_id));
716 ASSERT_EQ(0, bthread::execution_queue_join(queue_id));
717}
718
719TEST_F(ExecutionQueueTest, cancel_self) {
720 for (int i = 0; i < 2; ++i) {

Callers 1

TEST_FFunction · 0.85

Calls 5

execution_queue_startFunction · 0.85
execution_queue_executeFunction · 0.85
execution_queue_stopFunction · 0.85
execution_queue_joinFunction · 0.85
storeMethod · 0.45

Tested by

no test coverage detected