diff options
author | Maria Matejka <mq@ucw.cz> | 2023-01-24 11:01:34 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2023-01-26 13:22:28 +0100 |
commit | 05d8c3699d51866c68747167556e7c1f06390afe (patch) | |
tree | f4d02839aa5ad2086779974625e52ba5c2b028d0 /proto/radv | |
parent | 4334f86251429eb39bfe81ff19496d141fccef84 (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. This is
a backport from version 3 where these events are passed across threads.
This implementation of object locks doesn't use mutexes to lock the
whole data structure. In version 3, this data structure may get accessed
from multiple threads and must be protected by mutex.
Diffstat (limited to 'proto/radv')
-rw-r--r-- | proto/radv/radv.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/proto/radv/radv.c b/proto/radv/radv.c index 8b547f6d..ee1da36c 100644 --- a/proto/radv/radv.c +++ b/proto/radv/radv.c @@ -263,9 +263,9 @@ radv_iface_find(struct radv_proto *p, struct iface *what) } static void -radv_iface_add(struct object_lock *lock) +radv_iface_add(void *_ifa) { - struct radv_iface *ifa = lock->data; + struct radv_iface *ifa = _ifa; struct radv_proto *p = ifa->ra; if (! radv_sk_open(ifa)) @@ -302,8 +302,10 @@ radv_iface_new(struct radv_proto *p, struct iface *iface, struct radv_iface_conf lock->type = OBJLOCK_IP; lock->port = ICMPV6_PROTO; lock->iface = iface; - lock->data = ifa; - lock->hook = radv_iface_add; + lock->event = (event) { + .hook = radv_iface_add, + .data = ifa, + }; ifa->lock = lock; olock_acquire(lock); |