lets lock del too eh?
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 23 Oct 2010 04:36:52 +0000 (04:36 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 23 Oct 2010 04:36:52 +0000 (04:36 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@53796 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/mp/one_big/eina_one_big.c

index d26dbc7..47c9f22 100644 (file)
@@ -181,7 +181,8 @@ eina_one_big_free(void *data, void *ptr)
      }
    else
      {
-        Eina_Inlist *il = (Eina_Inlist *)(((unsigned char *)ptr) - sizeof(Eina_Inlist));
+        Eina_Inlist *il;
+        il = (Eina_Inlist *)(((unsigned char *)ptr) - sizeof(Eina_Inlist));
         pool->over_list = eina_inlist_remove(pool->over_list, il);
         free(il);
         pool->over--;
@@ -252,11 +253,16 @@ eina_one_big_init(const char *context,
 static void
 eina_one_big_shutdown(void *data)
 {
-   One_Big *pool;
-
-   pool = data;
+   One_Big *pool = data;
 
-   if (!pool) return ;
+   if (!pool) return;
+#ifdef EFL_HAVE_THREADS
+# ifdef EFL_HAVE_POSIX_THREADS
+   pthread_mutex_lock(&pool->mutex);
+# else
+   WaitForSingleObject(pool->mutex, INFINITE);
+# endif
+#endif
 
    if (pool->empty)
      {
@@ -302,6 +308,16 @@ eina_one_big_shutdown(void *data)
 #endif
 
    free(pool->base);
+   
+#ifdef EFL_HAVE_THREADS
+# ifdef EFL_HAVE_POSIX_THREADS
+   pthread_mutex_unlock(&pool->mutex);
+   pthread_mutex_destroy(&pool->mutex);
+# else
+   ReleaseMutex(pool->mutex);
+   // FIXME: how to do a mutex destroy in winland?
+# endif
+#endif
    free(pool);
 }