Fix crashes when terminating threads 72/161572/2 accepted/tizen/4.0/unified/20171128.072848 submit/tizen_4.0/20171127.095948
authorchanywa <cbible.kim@samsung.com>
Fri, 24 Nov 2017 07:41:02 +0000 (16:41 +0900)
committerSeechan Kim <cbible.kim@samsung.com>
Fri, 24 Nov 2017 07:41:37 +0000 (07:41 +0000)
Change-Id: I5c90d3c8cdcb2ea46deb0f5a2fe9a4b2045a0fce

maps-plugin-mapzen.changes
packaging/maps-plugin-mapzen.spec
src/mapzen/mapzen_restcurl.c

index 585f2d2..d1532af 100644 (file)
@@ -1,3 +1,8 @@
+[Version]   maps-plugin-mapzen_0.0.7
+[Date]      24 Nov 2017
+[Title]     Fix crashes when terminating threads
+[Developer] Seechan Kim <cbible.kim@samsung.com>
+
 [Version]   maps-plugin-mapzen_0.0.6
 [Date]      30 Oct 2017
 [Title]     Revise timeout limits for downloading map tiles.
index bfc045d..bae28a1 100644 (file)
@@ -1,6 +1,6 @@
 Name:       maps-plugin-mapzen
 Summary:    Tizen Mapzen Maps Plug-in Library
-Version:    0.0.6
+Version:    0.0.7
 Release:    1
 Group:      Location/Libraries
 License:    Apache-2.0 and MIT
index 913a717..b025a92 100644 (file)
@@ -537,11 +537,17 @@ static void *__curl_thread_handler(void *user_data)
                        }
                }
 
-               if (__thread_running_for_curlmulti && !__MultiCurlArgsRemain) {
-                       pthread_mutex_lock(&__curl_deliver_mutex);
-                       pthread_cond_wait(&__curl_delivered_cond, &__curl_deliver_mutex);
-                       pthread_mutex_unlock(&__curl_deliver_mutex);
-               }
+
+               struct timeval  now;
+               struct timespec timeout;
+               gettimeofday(&now, NULL);
+               timeout.tv_sec = now.tv_sec + 3;
+               timeout.tv_nsec = now.tv_usec * 1000;
+
+               pthread_mutex_lock(&__curl_deliver_mutex);
+               if (__thread_running_for_curlmulti && !__MultiCurlArgsRemain)
+                       pthread_cond_timedwait(&__curl_delivered_cond, &__curl_deliver_mutex, &timeout);
+               pthread_mutex_unlock(&__curl_deliver_mutex);
        }
 
 #else
@@ -604,7 +610,7 @@ int deinit_curl()
        pthread_cond_signal(&__curl_delivered_cond);
        pthread_mutex_unlock(&__curl_deliver_mutex);
 
-       pthread_cancel(__CurlThread);
+       //pthread_cancel(__CurlThread);
 
        pthread_join(__CurlThread, NULL);