celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ejans...@apache.org
Subject [1/2] celix git commit: [CELIX-256] fixed wrong ordering in case of not processing event
Date Tue, 23 Aug 2016 14:02:23 GMT
Repository: celix
Updated Branches:
  refs/heads/feature/event_admin 1db2379c1 -> e3fd7f1b2


[CELIX-256] fixed wrong ordering in case of not processing event


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

Branch: refs/heads/feature/event_admin
Commit: 05d719254b966fb6ea91aba984753672735c17df
Parents: 1db2379
Author: Erik Jansman <ejansman@apache.org>
Authored: Tue Aug 23 13:03:29 2016 +0200
Committer: Erik Jansman <ejansman@apache.org>
Committed: Tue Aug 23 13:03:29 2016 +0200

----------------------------------------------------------------------
 event_admin/event_admin/private/src/event_admin_impl.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/05d71925/event_admin/event_admin/private/src/event_admin_impl.c
----------------------------------------------------------------------
diff --git a/event_admin/event_admin/private/src/event_admin_impl.c b/event_admin/event_admin/private/src/event_admin_impl.c
index 37ca79d..a7204e1 100644
--- a/event_admin/event_admin/private/src/event_admin_impl.c
+++ b/event_admin/event_admin/private/src/event_admin_impl.c
@@ -118,17 +118,22 @@ void *eventProcessor(void *handle) {
         }
         if (event != NULL) {
             status = processEvent((*eventAdminPt), event);
+            const char *topic;
+
+            eventAdmin_getTopic(&event, &topic);
             if (status == CELIX_SUCCESS) {
-                const char *topic;
 
-                eventAdmin_getTopic(&event, &topic);
                 eventAdmin_unlockTopic((*eventAdminPt), topic);
                 event = NULL;
 
 
             } else {
+                do {
+                    status = celixThreadMutex_tryLock((*eventAdminPt)->eventListLock);
+                } while (status != 0);
                 //processing event unsuccesfull since topic is locked. put event back into
list for later processing.
-                eventAdmin_postEvent(*eventAdminPt, event);
+                linkedList_addFirst((*eventAdminPt)->eventList, event);
+                celixThreadMutex_unlock((*eventAdminPt)->eventListLock);
             }
         }
 


Mime
View raw message