diff options
author | Maria Matejka <mq@ucw.cz> | 2023-01-24 11:01:34 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2023-01-24 11:34:36 +0100 |
commit | f7c2a886c9fb73b2749d5e270f15b79c44e72a62 (patch) | |
tree | 602486438a95ce8bd1d71d0461227e0138b54b95 /proto/babel | |
parent | 3ac628e0f0b7ffaa49c95688cc95954ece8f61fc (diff) |
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.
Diffstat (limited to 'proto/babel')
-rw-r--r-- | proto/babel/babel.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c index a3a52f73..4db7c66f 100644 --- a/proto/babel/babel.c +++ b/proto/babel/babel.c @@ -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); } |