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

Function bthread_mutex_init

src/bthread/mutex.cpp:1185–1198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1183} // namespace bthread
1184
1185__BEGIN_DECLS
1186
1187int bthread_mutex_init(bthread_mutex_t* __restrict m,
1188 const bthread_mutexattr_t* __restrict attr) {
1189 bthread::make_contention_site_invalid(&m->csite);
1190 MUTEX_RESET_OWNER_COMMON(m->owner);
1191 m->butex = bthread::butex_create_checked<unsigned>();
1192 if (!m->butex) {
1193 return ENOMEM;
1194 }
1195 *m->butex = 0;
1196 m->enable_csite = NULL == attr ? true : attr->enable_csite;
1197 return 0;
1198}
1199
1200int bthread_mutex_destroy(bthread_mutex_t* m) {
1201 bthread::butex_destroy(m->butex);

Callers 8

TESTFunction · 0.85
TESTFunction · 0.85
BthreadCondMethod · 0.85
TESTFunction · 0.85
StreamMethod · 0.85
bthread_rwlock_initFunction · 0.85
MutexMethod · 0.85
operator()Method · 0.85

Calls 1

Tested by 4

TESTFunction · 0.68
TESTFunction · 0.68
BthreadCondMethod · 0.68
TESTFunction · 0.68