fast_mblock.[hc]: add function fast_mblock_free_objects
parent
a66370d0f8
commit
6957c19992
2
HISTORY
2
HISTORY
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
Version 1.54 2021-09-02
|
||||
Version 1.54 2021-09-09
|
||||
* fast_allocator.[hc]: correct reclaim_interval logic
|
||||
* shared_func.[hc]: add functions getFileContentEx1 and getFileContent1
|
||||
* fc_queue.[hc]: add function fc_queue_timedpeek
|
||||
|
|
|
|||
|
|
@ -858,6 +858,30 @@ int fast_mblock_batch_free(struct fast_mblock_man *mblock,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void fast_mblock_free_objects(struct fast_mblock_man *mblock,
|
||||
void **objs, const int count)
|
||||
{
|
||||
void **obj;
|
||||
void **end;
|
||||
struct fast_mblock_node *previous;
|
||||
struct fast_mblock_chain chain;
|
||||
|
||||
if (count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
chain.head = previous = fast_mblock_to_node_ptr(objs[0]);
|
||||
end = objs + count;
|
||||
for (obj=objs+1; obj<end; obj++) {
|
||||
previous->next = *obj;
|
||||
previous = *obj;
|
||||
}
|
||||
|
||||
previous->next = NULL;
|
||||
chain.tail = fast_mblock_to_node_ptr(previous);
|
||||
fast_mblock_batch_free(mblock, &chain);
|
||||
}
|
||||
|
||||
int fast_mblock_delay_free(struct fast_mblock_man *mblock,
|
||||
struct fast_mblock_node *pNode, const int deley)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -304,6 +304,9 @@ static inline int fast_mblock_free_object(struct fast_mblock_man *mblock,
|
|||
return fast_mblock_free(mblock, fast_mblock_to_node_ptr(object));
|
||||
}
|
||||
|
||||
void fast_mblock_free_objects(struct fast_mblock_man *mblock,
|
||||
void **objs, const int count);
|
||||
|
||||
/**
|
||||
delay free a object (put a node to the mblock)
|
||||
parameters:
|
||||
|
|
|
|||
Loading…
Reference in New Issue