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

Konstantin Osipov kostja at tarantool.org
Fri Mar 2 00:23:04 MSK 2018


* imarkov <imarkov at tarantool.org> [18/02/20 18:30]:
> 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.

This is puzzling.

First of all, you keep yielding, but now *only* in case the
timeout is zero. 

Secondly, I don't understand what implementation and what linked
list?

> ---
>  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);

What is this change for?
>  		else
>  			diag_set(TimedOut);

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.org - www.twitter.com/kostja_osipov



More information about the Tarantool-patches mailing list