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:
		| @@ -484,9 +484,9 @@ ospf_iface_find(struct ospf_proto *p, struct iface *what) | ||||
| } | ||||
|  | ||||
| static void | ||||
| ospf_iface_add(struct object_lock *lock) | ||||
| ospf_iface_add(void *_ifa) | ||||
| { | ||||
|   struct ospf_iface *ifa = lock->data; | ||||
|   struct ospf_iface *ifa = _ifa; | ||||
|   struct ospf_proto *p = ifa->oa->po; | ||||
|  | ||||
|   /* Open socket if interface is not stub */ | ||||
| @@ -668,8 +668,11 @@ ospf_iface_new(struct ospf_area *oa, struct ifa *addr, struct ospf_iface_patt *i | ||||
|   lock->port = OSPF_PROTO; | ||||
|   lock->inst = ifa->instance_id; | ||||
|   lock->iface = iface; | ||||
|   lock->data = ifa; | ||||
|   lock->hook = ospf_iface_add; | ||||
|   lock->event = (event) { | ||||
|     .hook = ospf_iface_add, | ||||
|     .data = ifa, | ||||
|   }; | ||||
|   lock->target = &global_event_list; | ||||
|  | ||||
|   olock_acquire(lock); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user