qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 5/6] co-shared-resource: protect with a mutex


From: Paolo Bonzini
Subject: Re: [PATCH 5/6] co-shared-resource: protect with a mutex
Date: Tue, 11 May 2021 10:34:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 10/05/21 13:40, Vladimir Sementsov-Ogievskiy wrote:

co-shared-resource is currently not thread-safe, as also reported
in co-shared-resource.h. Add a QemuMutex because co_try_get_from_shres
can also be invoked from non-coroutine context.

But it doesn't. It's called only from co_get_from_shres(). So, better make it a static function first.

It's a sensible interface though. It lets you sleep or retry in your own way if you cannot get the resources, so (apart from the unlocked/locked confusion in the names) I like keeping it in the public API.

Paolo




reply via email to

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