diff --git a/HISTORY b/HISTORY index 396ce68..0f9ed87 100644 --- a/HISTORY +++ b/HISTORY @@ -1,4 +1,7 @@ +Version 1.84 2025-12-23 + * fast_task_queue.h: add function free_queue_task_arg_offset + Version 1.83 2025-11-15 * fast_task_queue.h: remove field finish_callback diff --git a/src/fast_task_queue.c b/src/fast_task_queue.c index 719f7e6..d171749 100644 --- a/src/fast_task_queue.c +++ b/src/fast_task_queue.c @@ -28,7 +28,7 @@ static int task_alloc_init(struct fast_task_info *task, struct fast_task_queue *queue) { - task->arg = (char *)task + ALIGNED_TASK_INFO_SIZE + queue->padding_size; + task->arg = (char *)task + free_queue_task_arg_offset(queue); task->send.ptr = &task->send.holder; task->send.ptr->size = queue->min_buff_size; if (queue->malloc_whole_block) { diff --git a/src/fast_task_queue.h b/src/fast_task_queue.h index df85a4f..f63544d 100644 --- a/src/fast_task_queue.h +++ b/src/fast_task_queue.h @@ -236,6 +236,11 @@ static inline int free_queue_alloc_connections(struct fast_task_queue *queue) return queue->allocator.info.element_total_count; } +static inline int free_queue_task_arg_offset(struct fast_task_queue *queue) +{ + return ALIGNED_TASK_INFO_SIZE + queue->padding_size; +} + int free_queue_get_new_buffer_size(const int min_buff_size, const int max_buff_size, const int expect_size, int *new_size);