[Tarantool-patches] [PATCH 1/1] fiber_cond: remove rlist_shift usages
Cyrill Gorcunov
gorcunov at gmail.com
Tue Mar 2 10:37:36 MSK 2021
On Mon, Mar 01, 2021 at 11:23:13PM +0100, Vladislav Shpilevoy wrote:
> @@ -94,7 +94,7 @@ fiber_cond_broadcast(struct fiber_cond *e)
> {
> while (! rlist_empty(&e->waiters)) {
> struct fiber *f;
> - f = rlist_shift_entry(&e->waiters, struct fiber, state);
> + f = rlist_first_entry(&e->waiters, struct fiber, state);
> fiber_wakeup(f);
> }
> }
The fiber_wakeup ignores
if (f->flags & (FIBER_IS_READY | FIBER_IS_DEAD))
return;
can't we hit the situation where fiber_cond_broadcast called with
dead fiber so that it won't be deleted from the list with new code?
Actually looking into fiber_loop code I see
static void
fiber_loop(MAYBE_UNUSED void *data)
{
...
fiber->flags |= FIBER_IS_DEAD;
while (! rlist_empty(&fiber->wake)) {
struct fiber *f;
f = rlist_shift_entry(&fiber->wake, struct fiber,
state);
assert(f != fiber);
fiber_wakeup(f);
}
so it should be safe with your patch, but just to make sure I didn't
miss something obvious.
More information about the Tarantool-patches
mailing list