From f7c2a886c9fb73b2749d5e270f15b79c44e72a62 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Tue, 24 Jan 2023 11:01:34 +0100 Subject: 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. --- nest/locks.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'nest/locks.h') 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 -- cgit v1.2.3