summaryrefslogtreecommitdiff
path: root/nest/locks.h
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2023-01-24 11:01:34 +0100
committerMaria Matejka <mq@ucw.cz>2023-01-24 11:34:36 +0100
commitf7c2a886c9fb73b2749d5e270f15b79c44e72a62 (patch)
tree602486438a95ce8bd1d71d0461227e0138b54b95 /nest/locks.h
parent3ac628e0f0b7ffaa49c95688cc95954ece8f61fc (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 'nest/locks.h')
-rw-r--r--nest/locks.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/nest/locks.h b/nest/locks.h
index 37026c68..04571e69 100644
--- a/nest/locks.h
+++ b/nest/locks.h
@@ -31,8 +31,8 @@ struct object_lock {
uint inst; /* ... instance ID */
struct iface *iface; /* ... interface */
struct iface *vrf; /* ... or VRF (if iface is unknown) */
- void (*hook)(struct object_lock *); /* Called when the lock succeeds */
- void *data; /* User data */
+ event event; /* Enqueued when the lock succeeds */
+ event_list *target; /* Where to put the event */
/* ... internal to lock manager, don't touch ... */
node n; /* Node in list of olocks */
int state; /* OLOCK_STATE_xxx */
@@ -50,6 +50,5 @@ void olock_init(void);
#define OLOCK_STATE_FREE 0
#define OLOCK_STATE_LOCKED 1
#define OLOCK_STATE_WAITING 2
-#define OLOCK_STATE_EVENT 3 /* waiting for unlock processing */
#endif