qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [v5 02/12] migration: Add the framework of multi-thread


From: Juan Quintela
Subject: Re: [Qemu-devel] [v5 02/12] migration: Add the framework of multi-thread compression
Date: Wed, 11 Feb 2015 09:55:10 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Liang Li <address@hidden> wrote:
> Add the code to create and destroy the multiple threads those will
> be used to do data compression. Left some functions empty to keep
> clearness, and the code will be added later.
>
> Signed-off-by: Liang Li <address@hidden>
> Signed-off-by: Yang Zhang <address@hidden>
> Reviewed-by: Dr.David Alan Gilbert <address@hidden>

/me goes back

> +struct CompressParam {
> +    /* To be done */
> +};
> +typedef struct CompressParam CompressParam;
> +
> +static CompressParam *comp_param;
> +static bool quit_comp_thread;
> +
> +static void *do_data_compress(void *opaque)
> +{
> +    while (!quit_comp_thread) {

Using this variable without any protection, read from all threads.

> +
> +    /* To be done */
> +
> +    }
> +
> +    return NULL;
> +}
> +
> +static inline void terminate_compression_threads(void)
> +{
> +    quit_comp_thread = true;

written from the main migration thread.  Shouldn't we use a mutex or at
least atomic accessors?

PD. I haven't yet finishing reading the series, in case this is fixed later.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]