eina: check pending lock at the right time.
authorcedric <cedric>
Mon, 9 May 2011 10:29:55 +0000 (10:29 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 9 May 2011 10:29:55 +0000 (10:29 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eina@59286 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/eina_main.c

index d39f60b..bb60c19 100644 (file)
@@ -283,7 +283,13 @@ eina_threads_shutdown(void)
 
    assert(pthread_equal(_eina_main_loop, pthread_self()));
    assert(_eina_main_thread_count > 0);
+#endif
+
+   ret = --_eina_main_thread_count;
+   if(_eina_main_thread_count > 0)
+     return ret;
 
+#ifdef EINA_HAVE_DEBUG_THREADS
    pthread_mutex_lock(&_eina_tracking_lock);
    if (_eina_tracking)
      {
@@ -297,13 +303,8 @@ eina_threads_shutdown(void)
        abort();
      }
    pthread_mutex_unlock(&_eina_tracking_lock);
-
 #endif
 
-   ret = --_eina_main_thread_count;
-   if(_eina_main_thread_count > 0)
-     return ret;
-
    eina_share_common_threads_shutdown();
    eina_log_threads_shutdown();