[PATCH v2] server: Implement serial port read interval timeouts.

Alexandre Julliard julliard at winehq.org
Fri Jan 22 02:54:14 CST 2016


Alex Henrie <alexhenrie24 at gmail.com> writes:

> Fixes https://bugs.winehq.org/show_bug.cgi?id=39875
>
> There is a test program attached to the bug report.
>
> Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
> ---
>  server/async.c  | 14 ++++++++++++++
>  server/fd.c     | 12 ++++++++++++
>  server/file.h   |  3 +++
>  server/serial.c | 13 ++++++++++++-
>  4 files changed, 41 insertions(+), 1 deletion(-)
>
> diff --git a/server/async.c b/server/async.c
> index d2da976..e718462 100644
> --- a/server/async.c
> +++ b/server/async.c
> @@ -216,6 +216,20 @@ void free_async_queue( struct async_queue *queue )
>      release_object( queue );
>  }
>  
> +/* set the timeout of the async queue head if the new timeout is shorter than the current one */
> +/* only pass negative timeouts (i.e. timeouts relative to the current time) to this function */
> +void async_queue_set_shorter_timeout( struct async_queue *queue, timeout_t timeout, unsigned int status )
> +{
> +    struct list *ptr;
> +    struct async *async;
> +
> +    if (!(ptr = list_head( &queue->queue ))) return;
> +    async = LIST_ENTRY( ptr, struct async, queue_entry );
> +
> +    if (!async->timeout || -timeout < get_timeout_user_remaining( async->timeout ))
> +        async_set_timeout( async, timeout, status );
> +}

You should be able to do this in the serial code, probably by using
absolute timeouts. Note that you also need to preserve the original
timeout, you can't simply replace it by the interval timeout.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list