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

Function get_thread_local_keytable_list_length

src/bthread/key.cpp:505–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

503}
504
505int get_thread_local_keytable_list_length(bthread_keytable_pool_t* pool) {
506 if (pool == NULL) {
507 LOG(ERROR) << "Param[pool] is NULL";
508 return EINVAL;
509 }
510 int length = 0;
511 pthread_rwlock_rdlock(&pool->rwlock);
512 if (pool->destroyed) {
513 pthread_rwlock_unlock(&pool->rwlock);
514 return length;
515 }
516 auto list = (butil::ThreadLocal<bthread::KeyTableList>*)pool->list;
517 if (list) {
518 length = (int)(list->get()->get_length());
519 if (!list->get()->check_length()) {
520 LOG(ERROR) << "Length is not equal";
521 }
522 }
523 pthread_rwlock_unlock(&pool->rwlock);
524 return length;
525}
526
527// TODO: this is not strict `reserve' because we only check #free.
528// Currently there's no way to track KeyTables that may be returned

Callers 2

usleep_thread_implFunction · 0.85
return_thread_implFunction · 0.85

Calls 2

get_lengthMethod · 0.80
getMethod · 0.45

Tested by 2

usleep_thread_implFunction · 0.68
return_thread_implFunction · 0.68