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

Function locker

test/bthread_mutex_unittest.cpp:37–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35long start_time = butil::cpuwide_time_ms();
36int c = 0;
37void* locker(void* arg) {
38 bthread_mutex_t* m = (bthread_mutex_t*)arg;
39 bthread_mutex_lock(m);
40 printf("[%" PRIu64 "] I'm here, %d, %" PRId64 "ms\n",
41 pthread_numeric_id(), ++c, butil::cpuwide_time_ms() - start_time);
42 bthread_usleep(10000);
43 bthread_mutex_unlock(m);
44 return NULL;
45}
46
47TEST(MutexTest, sanity) {
48 bthread_mutex_t m;

Callers

nothing calls this directly

Calls 5

bthread_mutex_lockFunction · 0.85
pthread_numeric_idFunction · 0.85
cpuwide_time_msFunction · 0.85
bthread_usleepFunction · 0.85
bthread_mutex_unlockFunction · 0.85

Tested by

no test coverage detected