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/rip/rip.c | |
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/rip/rip.c')
-rw-r--r-- | proto/rip/rip.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/proto/rip/rip.c b/proto/rip/rip.c index bd087246..b3a4e81e 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -667,9 +667,9 @@ rip_iface_update_bfd(struct rip_iface *ifa) static void -rip_iface_locked(struct object_lock *lock) +rip_iface_locked(void *_ifa) { - struct rip_iface *ifa = lock->data; + struct rip_iface *ifa = _ifa; struct rip_proto *p = ifa->rip; if (!rip_open_socket(ifa)) @@ -731,8 +731,11 @@ rip_add_iface(struct rip_proto *p, struct iface *iface, struct rip_iface_config lock->type = OBJLOCK_UDP; lock->port = ic->port; lock->iface = iface; - lock->data = ifa; - lock->hook = rip_iface_locked; + lock->event = (event) { + .hook = rip_iface_locked, + .data = ifa, + }; + lock->target = &global_event_list; ifa->lock = lock; olock_acquire(lock); |