From 800cec7311955e1d9dfd2b9f881712d002090f3a Mon Sep 17 00:00:00 2001 From: imarkov <imarkov@tarantool.org> Date: Tue, 20 Feb 2018 10:14:50 +0300 Subject: [PATCH] coio: Modify coio_task_post behavior Remove yielding and waiting task complete in coio_task_post in case if timeout is zero. This patch is inspired by the need in log_rotate posting coio task. This post should not yield there because the implementation of multiple loggers works with linked list structure of loggers which is not fiber-safe. --- src/coio_task.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/coio_task.c b/src/coio_task.c index 0ba83a5a32..61f376203d 100644 --- a/src/coio_task.c +++ b/src/coio_task.c @@ -234,6 +234,15 @@ coio_task_post(struct coio_task *task, double timeout) assert(task->fiber == fiber()); eio_submit(&task->base); + if (timeout == 0) { + /* + * This is a special case: + * we don't wait any response from the task + * and just perform just asynchronous post. + */ + task->fiber = NULL; + return 0; + } fiber_yield_timeout(timeout); if (!task->complete) { /* timed out or cancelled. */ -- GitLab