bugfixed: fast_mblock_batch_alloc correct return value

pull/47/head
YuQing 2023-05-28 16:30:43 +08:00
parent 8de24ad5b5
commit 0c588d965e
2 changed files with 11 additions and 9 deletions

View File

@ -1,11 +1,12 @@
Version 1.67 2023-05-23 Version 1.67 2023-05-28
* lc_pair in struct fc_queue change to lcp * lc_pair in struct fc_queue change to lcp
* sorted queue use double link chain for quick push * sorted queue use double link chain for quick push
* add function uniq_skiplist_clear * add function uniq_skiplist_clear
* fast_mblock_malloc_trunk_notify_func prototype changed * fast_mblock_malloc_trunk_notify_func prototype changed
* fast_mblock_init_ex2 add parameter prealloc_trunk_count * fast_mblock_init_ex2 add parameter prealloc_trunk_count
* sorted_queue.[hc] support pop_compare_func * sorted_queue.[hc] support pop_compare_func
* bugfixed: fast_mblock_batch_alloc correct return value
Version 1.66 2023-02-12 Version 1.66 2023-02-12
* struct fast_task_info add field: notify_next for nio notify queue * struct fast_task_info add field: notify_next for nio notify queue

View File

@ -878,16 +878,17 @@ int fast_mblock_batch_alloc(struct fast_mblock_man *mblock,
{ {
struct fast_mblock_node *pNode; struct fast_mblock_node *pNode;
int i; int i;
int lr;
int result; int result;
if (mblock->need_lock && (result=pthread_mutex_lock( if (mblock->need_lock && (lr=pthread_mutex_lock(
&mblock->lcp.lock)) != 0) &mblock->lcp.lock)) != 0)
{ {
logError("file: "__FILE__", line: %d, " logError("file: "__FILE__", line: %d, "
"call pthread_mutex_lock fail, " "call pthread_mutex_lock fail, "
"errno: %d, error info: %s", "errno: %d, error info: %s",
__LINE__, result, STRERROR(result)); __LINE__, lr, STRERROR(lr));
return result; return lr;
} }
if ((chain->head=alloc_node(mblock)) != NULL) { if ((chain->head=alloc_node(mblock)) != NULL) {
@ -914,13 +915,13 @@ int fast_mblock_batch_alloc(struct fast_mblock_man *mblock,
result = ENOMEM; result = ENOMEM;
} }
if (mblock->need_lock && (result=pthread_mutex_unlock( if (mblock->need_lock && (lr=pthread_mutex_unlock(
&mblock->lcp.lock)) != 0) &mblock->lcp.lock)) != 0)
{ {
logError("file: "__FILE__", line: %d, " \ logError("file: "__FILE__", line: %d, "
"call pthread_mutex_unlock fail, " \ "call pthread_mutex_unlock fail, "
"errno: %d, error info: %s", \ "errno: %d, error info: %s",
__LINE__, result, STRERROR(result)); __LINE__, lr, STRERROR(lr));
} }
return result; return result;