Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MJY-HUST committed Sep 21, 2024
1 parent 2f336a7 commit 72a186d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/bthread/key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ class BAIDU_CACHELINE_ALIGNMENT KeyTableList {
return temp;
}

void move_first_n_to_target(KeyTable* target, uint32_t size) {
if (size < _length || _head == NULL) {
void move_first_n_to_target(KeyTable** target, uint32_t size) {
if (size > _length || _head == NULL) {
return;
}

Expand All @@ -283,10 +283,10 @@ class BAIDU_CACHELINE_ALIGNMENT KeyTableList {
}
if (prev != NULL) {
prev->next = NULL;
if (target == NULL) {
target = _head;
if (*target == NULL) {
*target = _head;
} else {
target->next = _head;
(*target)->next = _head;
}
_head = current;
_length -= size;
Expand Down Expand Up @@ -367,7 +367,7 @@ void return_keytable(bthread_keytable_pool_t* pool, KeyTable* kt) {
pthread_rwlock_unlock(&pool->rwlock);
pthread_rwlock_wrlock(&pool->rwlock);
if (!pool->destroyed) {
list->get()->move_first_n_to_target((KeyTable*)pool->free_keytables,
list->get()->move_first_n_to_target((KeyTable**)(&pool->free_keytables),
KEY_TABLE_LIST_SIZE / 2);
}
}
Expand Down

0 comments on commit 72a186d

Please sign in to comment.