1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Object locks use events

Instead of calling custom hooks from object locks, we use standard event
sending mechanism to inform protocols about object lock changes. As
event sending is lockless, the unlocking protocol simply enqueues the
appropriate event to the given loop when the locking is done.
This commit is contained in:
Maria Matejka
2023-01-24 11:01:34 +01:00
parent 3ac628e0f0
commit f7c2a886c9
7 changed files with 75 additions and 55 deletions

View File

@@ -1761,9 +1761,9 @@ babel_find_iface(struct babel_proto *p, struct iface *what)
}
static void
babel_iface_locked(struct object_lock *lock)
babel_iface_locked(void *_ifa)
{
struct babel_iface *ifa = lock->data;
struct babel_iface *ifa = _ifa;
struct babel_proto *p = ifa->proto;
if (!babel_open_socket(ifa))
@@ -1818,8 +1818,11 @@ babel_add_iface(struct babel_proto *p, struct iface *new, struct babel_iface_con
lock->addr = IP6_BABEL_ROUTERS;
lock->port = ifa->cf->port;
lock->iface = ifa->iface;
lock->hook = babel_iface_locked;
lock->data = ifa;
lock->event = (event) {
.hook = babel_iface_locked,
.data = ifa,
};
lock->target = &global_event_list;
olock_acquire(lock);
}