qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 21/26] rust: tests: allow writing more than one test


From: Zhao Liu
Subject: Re: [PATCH 21/26] rust: tests: allow writing more than one test
Date: Thu, 12 Dec 2024 18:04:24 +0800

> +fn init_qom() {
> +    static ONCE: Mutex<Cell<bool>> = Mutex::new(Cell::new(false));
> +
> +    let g = ONCE.lock().unwrap();
> +    if !g.get() {
> +        unsafe {
> +            module_call_init(module_init_type::MODULE_INIT_QOM);
> +        }
> +        g.set(true);
> +    }
> +}

Only one question: what is the purpose of using a Mutex here?

Others LGTM,

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>




reply via email to

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