celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1620372 - /celix/trunk/remote_services/topology_manager/private/src/topology_manager.c
Date Mon, 25 Aug 2014 16:47:39 GMT
Author: abroekhuis
Date: Mon Aug 25 16:47:38 2014
New Revision: 1620372

URL: http://svn.apache.org/r1620372
Log:
CELIX-142: Applied patch

Modified:
    celix/trunk/remote_services/topology_manager/private/src/topology_manager.c

Modified: celix/trunk/remote_services/topology_manager/private/src/topology_manager.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c?rev=1620372&r1=1620371&r2=1620372&view=diff
==============================================================================
--- celix/trunk/remote_services/topology_manager/private/src/topology_manager.c (original)
+++ celix/trunk/remote_services/topology_manager/private/src/topology_manager.c Mon Aug 25
16:47:38 2014
@@ -50,6 +50,8 @@ struct topology_manager {
 
 	celix_thread_mutex_t importedServicesLock;
 	hash_map_pt importedServices;
+
+	celix_thread_mutex_t importInterestsLock;
 	hash_map_pt importInterests;
 };
 
@@ -76,6 +78,7 @@ celix_status_t topologyManager_create(bu
 	status = celixThreadMutex_create(&(*manager)->rsaListLock, NULL);
 	status = celixThreadMutex_create(&(*manager)->exportedServicesLock, NULL);
 	status = celixThreadMutex_create(&(*manager)->importedServicesLock, NULL);
+	status = celixThreadMutex_create(&(*manager)->importInterestsLock, NULL);
 
 	(*manager)->exportedServices = hashMap_create(serviceReference_hashCode, NULL, serviceReference_equals2,
NULL);
 	(*manager)->importedServices = hashMap_create(NULL, NULL, NULL, NULL);
@@ -104,11 +107,17 @@ celix_status_t topologyManager_destroy(t
 	status = celixThreadMutex_lock(&manager->importedServicesLock);
 
 	hashMap_destroy(manager->importedServices, false, false);
-	hashMap_destroy(manager->importInterests, false, false);
 
 	status = celixThreadMutex_unlock(&manager->importedServicesLock);
 	status = celixThreadMutex_destroy(&manager->importedServicesLock);
 
+	status = celixThreadMutex_lock(&manager->importInterestsLock);
+
+	hashMap_destroy(manager->importInterests, false, false);
+
+	status = celixThreadMutex_unlock(&manager->importInterestsLock);
+	status = celixThreadMutex_destroy(&manager->importInterestsLock);
+
 	free(manager);
 
 	return status;
@@ -135,7 +144,6 @@ celix_status_t topologyManager_rsaAdded(
 	status = celixThreadMutex_unlock(&manager->rsaListLock);
 
 	// TODO add the imported/exported services to the given RSA...
-	manager->exportedServices;
 
 	return status;
 }
@@ -487,7 +495,7 @@ celix_status_t topologyManager_listenerA
 		char *filter = NULL;
 		topologyManager_extendFilter(manager->context, info->filter, &filter);
 
-		status = celixThreadMutex_lock(&manager->importedServicesLock);
+		status = celixThreadMutex_lock(&manager->importInterestsLock);
 
 		struct import_interest *interest = hashMap_get(manager->importInterests, filter);
 		if (interest) {
@@ -499,7 +507,7 @@ celix_status_t topologyManager_listenerA
 			hashMap_put(manager->importInterests, filter, interest);
 		}
 
-		status = celixThreadMutex_unlock(&manager->importedServicesLock);
+		status = celixThreadMutex_unlock(&manager->importInterestsLock);
 	}
 
 	return status;
@@ -525,7 +533,7 @@ celix_status_t topologyManager_listenerR
 		char *filter = NULL;
 		topologyManager_extendFilter(manager->context, info->filter, &filter);
 
-		status = celixThreadMutex_lock(&manager->importedServicesLock);
+		status = celixThreadMutex_lock(&manager->importInterestsLock);
 
 		struct import_interest *interest = hashMap_get(manager->importInterests, filter);
 		if (interest != NULL && interest->refs-- <= 0) {
@@ -533,7 +541,7 @@ celix_status_t topologyManager_listenerR
 			interest = hashMap_remove(manager->importInterests, filter);
 		}
 
-		status = celixThreadMutex_unlock(&manager->importedServicesLock);
+		status = celixThreadMutex_unlock(&manager->importInterestsLock);
 	}
 
 	return status;



Mime
View raw message