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

Georgy Kirichenko georgy at tarantool.org
Thu Feb 22 09:18:44 MSK 2018


Seems to be Ok for me.
We need a possibility to full-asynchronous task posting without any waiting/
yielding. May be we should introduce a separate methods for asynchronous and 
synchronous task posting (for example task_post and task_exec), but i think 
current way is Ok for now.
@Kostja, please feedback

On Wednesday, February 21, 2018 10:38:30 AM MSK imarkov wrote:
> 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
> works with linked list structure 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. */

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20180222/c632ff66/attachment.sig>


More information about the Tarantool-patches mailing list