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

imarkov imarkov at tarantool.org
Tue Feb 20 18:28:27 MSK 2018


Remove yielding 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
works with linked list structure which is not fiber-safe.
---
 src/coio_task.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/coio_task.c b/src/coio_task.c
index 0ba83a5..31c2241 100644
--- a/src/coio_task.c
+++ b/src/coio_task.c
@@ -234,11 +234,13 @@ coio_task_post(struct coio_task *task, double timeout)
 	assert(task->fiber == fiber());
 
 	eio_submit(&task->base);
-	fiber_yield_timeout(timeout);
+	if (timeout == 0) {
+		fiber_yield_timeout(timeout);
+	}
 	if (!task->complete) {
 		/* timed out or cancelled. */
 		task->fiber = NULL;
-		if (fiber_is_cancelled())
+		if (fiber_is_cancelled() || timeout == 0)
 			diag_set(FiberIsCancelled);
 		else
 			diag_set(TimedOut);
-- 
2.7.4




More information about the Tarantool-patches mailing list