qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] coroutine: Make qemu_coroutine_self() return NULL if not in


From: Alberto Campinho Faria
Subject: Re: [PATCH] coroutine: Make qemu_coroutine_self() return NULL if not in coroutine
Date: Wed, 5 Oct 2022 18:40:15 +0100

On Wed, Oct 5, 2022 at 5:34 PM Kevin Wolf <kwolf@redhat.com> wrote:
> The coroutine_fn annotation for qemu_coroutine_self() is wrong, but I
> think it already works outside of coroutine context, and consistently in
> all three backends, by returning &leader.
>
> Changing that to NULL makes me kind of nervous because the callers might
> actually access the leader Coroutine object, and after this change they
> would crash. (And even if they didn't crash, they wouldn't be able to
> distinguish the leader coroutines of different threads any more.)
>
> Do we have an actual reason to make this chance? That is, do we have any
> case that was broken before?

No, I just wasn't sure if the current implementations would return a
meaningful value when called from outside coroutine context, but it
seems they do. I'll send a patch only dropping the coroutine_fn
annotation.

Thanks,
Alberto




reply via email to

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