celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject celix git commit: CELIX-307: "service registration set properties" deadlocks
Date Tue, 01 Dec 2015 16:49:48 GMT
Repository: celix
Updated Branches:
  refs/heads/develop f99256497 -> e3b4e59d2


CELIX-307: "service registration set properties" deadlocks


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

Branch: refs/heads/develop
Commit: e3b4e59d29895395595f195eaa8c6fdde177fd01
Parents: f992564
Author: Bjoern Petri <bpetri@apache.org>
Authored: Tue Dec 1 17:45:41 2015 +0100
Committer: Bjoern Petri <bpetri@apache.org>
Committed: Tue Dec 1 17:45:41 2015 +0100

----------------------------------------------------------------------
 framework/private/src/service_registration.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/e3b4e59d/framework/private/src/service_registration.c
----------------------------------------------------------------------
diff --git a/framework/private/src/service_registration.c b/framework/private/src/service_registration.c
index 7eed0bf..fb8cd0d 100644
--- a/framework/private/src/service_registration.c
+++ b/framework/private/src/service_registration.c
@@ -71,12 +71,15 @@ static celix_status_t serviceRegistration_createInternal(registry_callback_t
cal
 		}
 
 		reg->isUnregistering = false;
-        celixThreadRwlock_create(&reg->lock, NULL);
+		celixThreadRwlock_create(&reg->lock, NULL);
 
+		celixThreadRwlock_writeLock(&reg->lock);
 		serviceRegistration_initializeProperties(reg, dictionary);
-    } else {
-    	status = CELIX_ENOMEM;
-    }
+		celixThreadRwlock_unlock(&reg->lock);
+
+	} else {
+		status = CELIX_ENOMEM;
+	}
 
 	if (status == CELIX_SUCCESS) {
 		*out = reg;
@@ -132,13 +135,9 @@ static celix_status_t serviceRegistration_initializeProperties(service_registrat
 		properties_set(dictionary, (char *) OSGI_FRAMEWORK_OBJECTCLASS, registration->className);
 	}
 
+	registration->properties = dictionary;
 
-    celixThreadRwlock_writeLock(&registration->lock);
-    registration->properties = dictionary;
-    celixThreadRwlock_unlock(&registration->lock);
-
-
-    return CELIX_SUCCESS;
+	return CELIX_SUCCESS;
 }
 
 void serviceRegistration_invalidate(service_registration_pt registration) {
@@ -171,8 +170,7 @@ celix_status_t serviceRegistration_unregister(service_registration_pt
registrati
     callback.unregister = NULL;
     bundle_pt bundle = NULL;
 
-    if (notValidOrUnregistering) {
-		printf("Service is already unregistered\n");
+	if (notValidOrUnregistering) {
 		status = CELIX_ILLEGAL_STATE;
 	} else {
         celixThreadRwlock_writeLock(&registration->lock);


Mime
View raw message