[patches] [say 1/3] coio: Modify coio_task_post behavior

Ilya Markov imarkov at tarantool.org
Wed Mar 7 16:23:18 MSK 2018


From: imarkov <imarkov at tarantool.org>

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 0ba83a5..61f3762 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. */
-- 
2.7.4




More information about the Tarantool-patches mailing list