mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-03-21 22:07:03 +00:00
Fixed loop movement to not collide on LTT_MOVE
This commit is contained in:
parent
e0c09e6bee
commit
62432affd9
@ -355,7 +355,7 @@ birdloop_try_ping(struct birdloop *loop, u32 ltt)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do the real ping */
|
/* Do the real ping of Meta or Main */
|
||||||
LOOP_TRACE(loop, "sending pipe ping");
|
LOOP_TRACE(loop, "sending pipe ping");
|
||||||
wakeup_do_kick(loop->thread);
|
wakeup_do_kick(loop->thread);
|
||||||
return 0;
|
return 0;
|
||||||
@ -617,6 +617,7 @@ birdloop_set_thread(struct birdloop *loop, struct bird_thread *thr, struct birdl
|
|||||||
u32 ltt = atomic_fetch_or_explicit(&loop->thread_transition, LTT_MOVE, memory_order_acq_rel);
|
u32 ltt = atomic_fetch_or_explicit(&loop->thread_transition, LTT_MOVE, memory_order_acq_rel);
|
||||||
ASSERT_DIE((ltt & LTT_MOVE) == 0);
|
ASSERT_DIE((ltt & LTT_MOVE) == 0);
|
||||||
|
|
||||||
|
/* Wait until all previously started pings end */
|
||||||
while (ltt & LTT_PING)
|
while (ltt & LTT_PING)
|
||||||
{
|
{
|
||||||
birdloop_yield();
|
birdloop_yield();
|
||||||
@ -625,9 +626,22 @@ birdloop_set_thread(struct birdloop *loop, struct bird_thread *thr, struct birdl
|
|||||||
}
|
}
|
||||||
/* Now we are free of running pings */
|
/* Now we are free of running pings */
|
||||||
|
|
||||||
|
if (!thr)
|
||||||
|
{
|
||||||
|
/* Unschedule from Meta */
|
||||||
|
ev_postpone(&loop->event);
|
||||||
|
tm_stop(&loop->timer);
|
||||||
|
|
||||||
|
/* Request local socket reload */
|
||||||
|
this_thread->sock_changed = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Update the thread value */
|
/* Update the thread value */
|
||||||
loop->thread = thr;
|
loop->thread = thr;
|
||||||
|
|
||||||
|
/* Allow pings */
|
||||||
|
atomic_fetch_and_explicit(&loop->thread_transition, ~LTT_MOVE, memory_order_acq_rel);
|
||||||
|
|
||||||
/* Put into appropriate lists */
|
/* Put into appropriate lists */
|
||||||
if (thr)
|
if (thr)
|
||||||
{
|
{
|
||||||
@ -637,21 +651,11 @@ birdloop_set_thread(struct birdloop *loop, struct bird_thread *thr, struct birdl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Unschedule from Meta */
|
|
||||||
ev_postpone(&loop->event);
|
|
||||||
tm_stop(&loop->timer);
|
|
||||||
|
|
||||||
/* Request local socket reload */
|
|
||||||
this_thread->sock_changed = 1;
|
|
||||||
|
|
||||||
/* Put into pickup list */
|
/* Put into pickup list */
|
||||||
LOCK_DOMAIN(resource, group->domain);
|
LOCK_DOMAIN(resource, group->domain);
|
||||||
add_tail(&group->loops, &loop->n);
|
add_tail(&group->loops, &loop->n);
|
||||||
UNLOCK_DOMAIN(resource, group->domain);
|
UNLOCK_DOMAIN(resource, group->domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allow pings */
|
|
||||||
atomic_fetch_and_explicit(&loop->thread_transition, ~LTT_MOVE, memory_order_acq_rel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -878,6 +882,7 @@ poll_retry:;
|
|||||||
wakeup_drain(thr);
|
wakeup_drain(thr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Unset ping information for Meta */
|
||||||
atomic_fetch_and_explicit(&thr->meta->thread_transition, ~LTT_PING, memory_order_acq_rel);
|
atomic_fetch_and_explicit(&thr->meta->thread_transition, ~LTT_PING, memory_order_acq_rel);
|
||||||
|
|
||||||
/* Schedule loops with active sockets */
|
/* Schedule loops with active sockets */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user