summaryrefslogtreecommitdiff
path: root/src/modules/eina
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2012-12-31 16:14:40 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2012-12-31 16:14:40 +0000
commit4668d04f0493b26a4cce4d307a9ed1277553c082 (patch)
tree854c9af550983aafa5c8ae2f6030911940120ab8 /src/modules/eina
parent12e06024520c4d783380ceb0e6ec5d8e40dab6ae (diff)
efl: cleanup HAVE_THREADS and pthread usage outside of eina.
Eina now abstracts threads, so use that. the touched files had the EFL_HAVE_THREADS as it's mandatory now. SVN revision: 81935
Diffstat (limited to 'src/modules/eina')
-rw-r--r--src/modules/eina/mp/chained_pool/eina_chained_mempool.c26
-rw-r--r--src/modules/eina/mp/one_big/eina_one_big.c20
2 files changed, 13 insertions, 33 deletions
diff --git a/src/modules/eina/mp/chained_pool/eina_chained_mempool.c b/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
index 8ed2b42214..a9be2845f1 100644
--- a/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
+++ b/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
@@ -23,24 +23,14 @@
23#include <stdlib.h> 23#include <stdlib.h>
24#include <string.h> 24#include <string.h>
25 25
26#ifdef EFL_HAVE_POSIX_THREADS 26#ifdef EINA_HAVE_DEBUG_THREADS
27#include <pthread.h> 27# include <assert.h>
28
29# ifdef EINA_HAVE_DEBUG_THREADS
30# include <assert.h>
31# endif
32#endif 28#endif
33 29
34#ifdef EINA_DEBUG_MALLOC 30#ifdef EINA_DEBUG_MALLOC
35# include <malloc.h> 31# include <malloc.h>
36#endif 32#endif
37 33
38#ifdef EFL_HAVE_WIN32_THREADS
39# define WIN32_LEAN_AND_MEAN
40# include <windows.h>
41# undef WIN32_LEAN_AND_MEAN
42#endif
43
44#include "eina_config.h" 34#include "eina_config.h"
45#include "eina_inlist.h" 35#include "eina_inlist.h"
46#include "eina_error.h" 36#include "eina_error.h"
@@ -83,7 +73,7 @@ struct _Chained_Mempool
83 int minimal_size; 73 int minimal_size;
84#endif 74#endif
85#ifdef EINA_HAVE_DEBUG_THREADS 75#ifdef EINA_HAVE_DEBUG_THREADS
86 pthread_t self; 76 Eina_Tthread self;
87#endif 77#endif
88 Eina_Lock mutex; 78 Eina_Lock mutex;
89}; 79};
@@ -266,7 +256,7 @@ eina_chained_mempool_malloc(void *data, EINA_UNUSED unsigned int size)
266 if (!eina_lock_take(&pool->mutex)) 256 if (!eina_lock_take(&pool->mutex))
267 { 257 {
268#ifdef EINA_HAVE_DEBUG_THREADS 258#ifdef EINA_HAVE_DEBUG_THREADS
269 assert(pthread_equal(pool->self, pthread_self())); 259 assert(eina_thread_equal(pool->self, eina_thread_self()));
270#endif 260#endif
271 } 261 }
272 262
@@ -316,7 +306,7 @@ eina_chained_mempool_free(void *data, void *ptr)
316 if (!eina_lock_take(&pool->mutex)) 306 if (!eina_lock_take(&pool->mutex))
317 { 307 {
318#ifdef EINA_HAVE_DEBUG_THREADS 308#ifdef EINA_HAVE_DEBUG_THREADS
319 assert(pthread_equal(pool->self, pthread_self())); 309 assert(eina_thread_equal(pool->self, eina_thread_self()));
320#endif 310#endif
321 } 311 }
322 312
@@ -361,7 +351,7 @@ eina_chained_mempool_repack(void *data,
361 if (!eina_lock_take(&pool->mutex)) 351 if (!eina_lock_take(&pool->mutex))
362 { 352 {
363#ifdef EINA_HAVE_DEBUG_THREADS 353#ifdef EINA_HAVE_DEBUG_THREADS
364 assert(pthread_equal(pool->self, pthread_self())); 354 assert(eina_threadequal(pool->self, eina_threadself()));
365#endif 355#endif
366 } 356 }
367 357
@@ -479,7 +469,7 @@ eina_chained_mempool_init(const char *context,
479#endif 469#endif
480 470
481#ifdef EINA_HAVE_DEBUG_THREADS 471#ifdef EINA_HAVE_DEBUG_THREADS
482 mp->self = pthread_self(); 472 mp->self = eina_threadself();
483#endif 473#endif
484 474
485 eina_lock_new(&mp->mutex); 475 eina_lock_new(&mp->mutex);
@@ -523,7 +513,7 @@ eina_chained_mempool_shutdown(void *data)
523 eina_lock_free(&mp->mutex); 513 eina_lock_free(&mp->mutex);
524 514
525#ifdef EINA_HAVE_DEBUG_THREADS 515#ifdef EINA_HAVE_DEBUG_THREADS
526 assert(pthread_equal(mp->self, pthread_self())); 516 assert(eina_threadequal(mp->self, eina_threadself()));
527#endif 517#endif
528 518
529 free(mp); 519 free(mp);
diff --git a/src/modules/eina/mp/one_big/eina_one_big.c b/src/modules/eina/mp/one_big/eina_one_big.c
index 42c47ee685..cc96c8ea3b 100644
--- a/src/modules/eina/mp/one_big/eina_one_big.c
+++ b/src/modules/eina/mp/one_big/eina_one_big.c
@@ -23,18 +23,8 @@
23#include <stdlib.h> 23#include <stdlib.h>
24#include <string.h> 24#include <string.h>
25 25
26#ifdef EFL_HAVE_POSIX_THREADS
27# include <pthread.h>
28#endif
29
30#include <assert.h> 26#include <assert.h>
31 27
32#ifdef EFL_HAVE_WIN32_THREADS
33# define WIN32_LEAN_AND_MEAN
34# include <windows.h>
35# undef WIN32_LEAN_AND_MEAN
36#endif
37
38#include "eina_config.h" 28#include "eina_config.h"
39#include "eina_mempool.h" 29#include "eina_mempool.h"
40#include "eina_trash.h" 30#include "eina_trash.h"
@@ -78,7 +68,7 @@ struct _One_Big
78 Eina_Inlist *over_list; 68 Eina_Inlist *over_list;
79 69
80#ifdef EINA_HAVE_DEBUG_THREADS 70#ifdef EINA_HAVE_DEBUG_THREADS
81 pthread_t self; 71 Eina_Thread self;
82#endif 72#endif
83 Eina_Lock mutex; 73 Eina_Lock mutex;
84}; 74};
@@ -92,7 +82,7 @@ eina_one_big_malloc(void *data, EINA_UNUSED unsigned int size)
92 if (!eina_lock_take(&pool->mutex)) 82 if (!eina_lock_take(&pool->mutex))
93 { 83 {
94#ifdef EINA_HAVE_DEBUG_THREADS 84#ifdef EINA_HAVE_DEBUG_THREADS
95 assert(pthread_equal(pool->self, pthread_self())); 85 assert(eina_thread_equal(pool->self, eina_thread_self()));
96#endif 86#endif
97 } 87 }
98 88
@@ -160,7 +150,7 @@ eina_one_big_free(void *data, void *ptr)
160 if (!eina_lock_take(&pool->mutex)) 150 if (!eina_lock_take(&pool->mutex))
161 { 151 {
162#ifdef EINA_HAVE_DEBUG_THREADS 152#ifdef EINA_HAVE_DEBUG_THREADS
163 assert(pthread_equal(pool->self, pthread_self())); 153 assert(eina_thread_equal(pool->self, eina_thread_self()));
164#endif 154#endif
165 } 155 }
166 156
@@ -233,7 +223,7 @@ eina_one_big_init(const char *context,
233 } 223 }
234 224
235#ifdef EINA_HAVE_DEBUG_THREADS 225#ifdef EINA_HAVE_DEBUG_THREADS
236 pool->self = pthread_self(); 226 pool->self = eina_thread_self();
237#endif 227#endif
238 eina_lock_new(&pool->mutex); 228 eina_lock_new(&pool->mutex);
239 229
@@ -253,7 +243,7 @@ eina_one_big_shutdown(void *data)
253 if (!eina_lock_take(&pool->mutex)) 243 if (!eina_lock_take(&pool->mutex))
254 { 244 {
255#ifdef EINA_HAVE_DEBUG_THREADS 245#ifdef EINA_HAVE_DEBUG_THREADS
256 assert(pthread_equal(pool->self, pthread_self())); 246 assert(eina_thread_equal(pool->self, eina_thread_self()));
257#endif 247#endif
258 } 248 }
259 249