celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From griccia...@apache.org
Subject celix git commit: CELIX-375: Adapted TM locks for recursive behavior
Date Mon, 26 Sep 2016 12:06:52 GMT
Repository: celix
Updated Branches:
  refs/heads/develop d02d39304 -> 5521c0c8a


CELIX-375: Adapted TM locks for recursive behavior


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/5521c0c8
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/5521c0c8
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/5521c0c8

Branch: refs/heads/develop
Commit: 5521c0c8a5af01169fe5b283405068e8d5ff43c8
Parents: d02d393
Author: gricciardi <gricciardi@apache.org>
Authored: Mon Sep 26 14:06:38 2016 +0200
Committer: gricciardi <gricciardi@apache.org>
Committed: Mon Sep 26 14:06:38 2016 +0200

----------------------------------------------------------------------
 .../topology_manager/private/src/topology_manager.c  | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/5521c0c8/remote_services/topology_manager/private/src/topology_manager.c
----------------------------------------------------------------------
diff --git a/remote_services/topology_manager/private/src/topology_manager.c b/remote_services/topology_manager/private/src/topology_manager.c
index 09f069d..6472b01 100644
--- a/remote_services/topology_manager/private/src/topology_manager.c
+++ b/remote_services/topology_manager/private/src/topology_manager.c
@@ -49,6 +49,7 @@ struct topology_manager {
 	bundle_context_pt context;
 
 	celix_thread_mutex_t rsaListLock;
+	celix_thread_mutexattr_t rsaListLockAttr;
 	array_list_pt rsaList;
 
 	celix_thread_mutex_t listenerListLock;
@@ -58,6 +59,7 @@ struct topology_manager {
 	hash_map_pt exportedServices;
 
 	celix_thread_mutex_t importedServicesLock;
+	celix_thread_mutexattr_t importedServicesLockAttr;
 	hash_map_pt importedServices;
 
 	scope_pt scope;
@@ -84,9 +86,16 @@ celix_status_t topologyManager_create(bundle_context_pt context, log_helper_pt
l
 
 	arrayList_create(&(*manager)->rsaList);
 
-	celixThreadMutex_create(&(*manager)->rsaListLock, NULL);
+
+	celixThreadMutexAttr_create(&(*manager)->rsaListLockAttr);
+	celixThreadMutexAttr_settype(&(*manager)->rsaListLockAttr, CELIX_THREAD_MUTEX_RECURSIVE);
+	celixThreadMutex_create(&(*manager)->rsaListLock, &(*manager)->rsaListLockAttr);
+
+	celixThreadMutexAttr_create(&(*manager)->importedServicesLockAttr);
+	celixThreadMutexAttr_settype(&(*manager)->importedServicesLockAttr, CELIX_THREAD_MUTEX_RECURSIVE);
+	celixThreadMutex_create(&(*manager)->importedServicesLock, &(*manager)->importedServicesLockAttr);
+
 	celixThreadMutex_create(&(*manager)->exportedServicesLock, NULL);
-	celixThreadMutex_create(&(*manager)->importedServicesLock, NULL);
 	celixThreadMutex_create(&(*manager)->listenerListLock, NULL);
 
 	(*manager)->listenerList = hashMap_create(serviceReference_hashCode, NULL, serviceReference_equals2,
NULL);
@@ -119,6 +128,7 @@ celix_status_t topologyManager_destroy(topology_manager_pt manager) {
 
 	celixThreadMutex_unlock(&manager->rsaListLock);
 	celixThreadMutex_destroy(&manager->rsaListLock);
+	celixThreadMutexAttr_destroy(&manager->rsaListLockAttr);
 
 	celixThreadMutex_lock(&manager->exportedServicesLock);
 
@@ -133,6 +143,7 @@ celix_status_t topologyManager_destroy(topology_manager_pt manager) {
 
 	celixThreadMutex_unlock(&manager->importedServicesLock);
 	celixThreadMutex_destroy(&manager->importedServicesLock);
+	celixThreadMutexAttr_destroy(&manager->importedServicesLockAttr);
 
 	scope_scopeDestroy(manager->scope);
 	free(manager);


Mime
View raw message