1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

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.
This commit is contained in:
Maria Matejka
2023-01-24 11:01:34 +01:00
parent 3ac628e0f0
commit f7c2a886c9
7 changed files with 75 additions and 55 deletions

View File

@@ -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