add function sched_delay_free_ptr
parent
0381982ac2
commit
0410c7fedd
3
HISTORY
3
HISTORY
|
|
@ -1,7 +1,8 @@
|
||||||
|
|
||||||
Version 1.55 2022-01-09
|
Version 1.55 2022-01-12
|
||||||
* fastcommon php extension adapt to php 8
|
* fastcommon php extension adapt to php 8
|
||||||
* function fast_mblock_batch_alloc changed
|
* function fast_mblock_batch_alloc changed
|
||||||
|
* add function sched_delay_free_ptr
|
||||||
|
|
||||||
Version 1.54 2021-12-23
|
Version 1.54 2021-12-23
|
||||||
* fast_allocator.[hc]: correct reclaim_interval logic
|
* fast_allocator.[hc]: correct reclaim_interval logic
|
||||||
|
|
|
||||||
|
|
@ -963,3 +963,16 @@ uint32_t sched_generate_next_id()
|
||||||
{
|
{
|
||||||
return ++next_id;
|
return ++next_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int sched_free_ptr_func(void *ptr)
|
||||||
|
{
|
||||||
|
free(ptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sched_delay_free_ptr(void *ptr, const int delay_seconds)
|
||||||
|
{
|
||||||
|
const bool new_thread = false;
|
||||||
|
return sched_add_delay_task_ex(schedule_context, sched_free_ptr_func,
|
||||||
|
ptr, delay_seconds, new_thread);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,15 @@ int sched_add_delay_task(TaskFunc task_func, void *func_args,
|
||||||
const int delay_seconds, const bool new_thread);
|
const int delay_seconds, const bool new_thread);
|
||||||
|
|
||||||
|
|
||||||
|
/** delay free a pointer
|
||||||
|
* parameters:
|
||||||
|
* ptr: the ptr to free
|
||||||
|
* delay_seconds: delay seconds to free the ptr
|
||||||
|
* return: error no, 0 for success, != 0 fail
|
||||||
|
*/
|
||||||
|
int sched_delay_free_ptr(void *ptr, const int delay_seconds);
|
||||||
|
|
||||||
|
|
||||||
/** init the schedule context
|
/** init the schedule context
|
||||||
* parameters:
|
* parameters:
|
||||||
* pContext: store the ScheduleContext pointer
|
* pContext: store the ScheduleContext pointer
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue