You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by bp...@apache.org on 2015/12/01 17:49:48 UTC
celix git commit: CELIX-307: "service registration set properties"
deadlocks
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 <bp...@apache.org>
Authored: Tue Dec 1 17:45:41 2015 +0100
Committer: Bjoern Petri <bp...@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(®->lock, NULL);
+ celixThreadRwlock_create(®->lock, NULL);
+ celixThreadRwlock_writeLock(®->lock);
serviceRegistration_initializeProperties(reg, dictionary);
- } else {
- status = CELIX_ENOMEM;
- }
+ celixThreadRwlock_unlock(®->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(®istration->lock);
- registration->properties = dictionary;
- celixThreadRwlock_unlock(®istration->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(®istration->lock);