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

Function TEST

test/bthread_semaphore_unittest.cpp:43–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43TEST(SemaphoreTest, sanity) {
44 bthread_sem_t sem;
45 ASSERT_EQ(0, bthread_sem_init(&sem, 1));
46 ASSERT_EQ(0, bthread_sem_wait(&sem));
47 ASSERT_EQ(0, bthread_sem_post(&sem));
48 ASSERT_EQ(0, bthread_sem_wait(&sem));
49
50 bthread_t waiter_th;
51 bthread_t poster_th;
52 ASSERT_EQ(0, bthread_start_urgent(&waiter_th, NULL, sem_waiter, &sem));
53 ASSERT_EQ(0, bthread_start_urgent(&poster_th, NULL, sem_poster, &sem));
54 ASSERT_EQ(0, bthread_join(waiter_th, NULL));
55 ASSERT_EQ(0, bthread_join(poster_th, NULL));
56
57 ASSERT_EQ(0, bthread_sem_destroy(&sem));
58}
59
60
61

Callers

nothing calls this directly

Calls 11

bthread_sem_initFunction · 0.85
bthread_sem_waitFunction · 0.85
bthread_sem_postFunction · 0.85
bthread_start_urgentFunction · 0.85
bthread_joinFunction · 0.85
bthread_sem_destroyFunction · 0.85
bthread_sem_trywaitFunction · 0.85
bthread_setconcurrencyFunction · 0.85
reserveMethod · 0.45
push_backMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected