Change in osmo-remsim[master]: slotmap: Add _slotmap_del() for callers that already have a lock

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Mar 7 17:34:47 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/13183


Change subject: slotmap: Add _slotmap_del() for callers that already have a lock
......................................................................

slotmap: Add _slotmap_del() for callers that already have a lock

Change-Id: Id05872c3676d0afe4c7abe74677fee62b4f03e53
---
M src/slotmap.c
M src/slotmap.h
2 files changed, 9 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/83/13183/1

diff --git a/src/slotmap.c b/src/slotmap.c
index 703dd02..aa03638 100644
--- a/src/slotmap.c
+++ b/src/slotmap.c
@@ -115,21 +115,26 @@
 }
 
 /* thread-safe removal of a bank<->client map */
-void slotmap_del(struct slotmaps *maps, struct slot_mapping *map)
+void _slotmap_del(struct slotmaps *maps, struct slot_mapping *map)
 {
 	char mapname[64];
 
 	printf("Slot Map %s deleted\n", slotmap_name(mapname, sizeof(mapname), map));
 
-	pthread_rwlock_wrlock(&maps->rwlock);
 	llist_del(&map->list);
 #ifdef REMSIM_SERVER
 	llist_del(&map->bank_list);
 #endif
-	pthread_rwlock_unlock(&maps->rwlock);
 
 	talloc_free(map);
 }
+/* thread-safe removal of a bank<->client map */
+void slotmap_del(struct slotmaps *maps, struct slot_mapping *map)
+{
+	pthread_rwlock_wrlock(&maps->rwlock);
+	_slotmap_del(maps, map);
+	pthread_rwlock_unlock(&maps->rwlock);
+}
 
 struct slotmaps *slotmap_init(void *ctx)
 {
diff --git a/src/slotmap.h b/src/slotmap.h
index a26de6d..3eb976f 100644
--- a/src/slotmap.h
+++ b/src/slotmap.h
@@ -81,6 +81,7 @@
 
 /* thread-safe removal of a bank<->client map */
 void slotmap_del(struct slotmaps *maps, struct slot_mapping *map);
+void _slotmap_del(struct slotmaps *maps, struct slot_mapping *map);
 
 /* initialize the entire map collection */
 struct slotmaps *slotmap_init(void *ctx);

-- 
To view, visit https://gerrit.osmocom.org/13183
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id05872c3676d0afe4c7abe74677fee62b4f03e53
Gerrit-Change-Number: 13183
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190307/b0cbfb88/attachment.html>


More information about the gerrit-log mailing list