fixed mutex lock bug
authorJaeho Lee <jaeho81.lee@samsung.com>
Fri, 28 Jun 2013 05:17:04 +0000 (14:17 +0900)
committerJaeho Lee <jaeho81.lee@samsung.com>
Fri, 28 Jun 2013 05:17:04 +0000 (14:17 +0900)
Signed-off-by: Jaeho Lee <jaeho81.lee@samsung.com>
packaging/aul.spec
src/launch_with_result.c

index 2008194..c706bd8 100644 (file)
@@ -1,6 +1,6 @@
 Name:       aul
 Summary:    App utility library
-Version:    0.0.275
+Version:    0.0.276
 Release:    1
 Group:      System/Libraries
 License:    Apache License, Version 2.0
index 0dc847a..62b6904 100755 (executable)
@@ -80,12 +80,16 @@ static app_resultcb_info_t *__find_resultcb(int pid)
 {
        app_resultcb_info_t *tmp;
 
+       pthread_mutex_lock(&result_lock);
        tmp = rescb_head;
        while (tmp) {
-               if (tmp->launched_pid == pid)
+               if (tmp->launched_pid == pid) {
+                       pthread_mutex_unlock(&result_lock);
                        return tmp;
+               }
                tmp = tmp->next;
        }
+       pthread_mutex_unlock(&result_lock);
        return NULL;
 }
 
@@ -246,7 +250,6 @@ int _app_start_res_prepare(bundle *kb)
 
 int app_result(int cmd, bundle *kb, int launched_pid)
 {
-       pthread_mutex_lock(&result_lock);
        switch (cmd) {
        case APP_RESULT:
                __call_app_result_callback(kb, 0, launched_pid);
@@ -255,7 +258,7 @@ int app_result(int cmd, bundle *kb, int launched_pid)
                __call_app_result_callback(kb, 1, launched_pid);
                break;
        }
-       pthread_mutex_unlock(&result_lock);
+
        return 0;
 }