cedric pushed a commit to branch master.
commit 2fdc05863d1d2b97890005157d44f09db4e82bc4
Author: Cedric Bail <[email protected]>
Date: Tue Jul 2 13:45:30 2013 +0900
eet: force thread to always run during eet_cache_concurrency test.
---
ChangeLog | 4 ++++
NEWS | 1 +
src/tests/eet/eet_suite.c | 19 +++++++++++++++++++
3 files changed, 24 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 60f4bff..d32ae0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-07-02 Cedric Bail
+
+ * Eet: force thread to always run during eet_cache_concurrency test.
+
2013-06-25 Tom Hacohen
* Evas textblock: Fixed issue when parsing formats with quotes.
diff --git a/NEWS b/NEWS
index cbbb71d..c2468d9 100644
--- a/NEWS
+++ b/NEWS
@@ -195,6 +195,7 @@ Improvements:
* evas: use eo array of callbacks to reduce callbacks memory footprint of
Evas_Object_Box and Evas_Object_Table.
* evas: optimized path for when map use the same color for all corner.
* Edje entry: Move cursor to correct position when selection handlers are
pressed.
+ * eet: force thread to always run during eet_cache_concurrency test.
Fixes:
* Fix a memory leak in ecore_con_dns when using ecore_con_server_connect
diff --git a/src/tests/eet/eet_suite.c b/src/tests/eet/eet_suite.c
index dec16ed..5067208 100644
--- a/src/tests/eet/eet_suite.c
+++ b/src/tests/eet/eet_suite.c
@@ -1843,10 +1843,14 @@ START_TEST(eet_cipher_decipher_simple)
END_TEST
static Eina_Bool open_worker_stop;
+static Eina_Condition open_worker_cond;
+static Eina_Lock open_worker_mutex;
static void *
open_close_worker(void *path, Eina_Thread tid EINA_UNUSED)
{
+ static Eina_Bool first = EINA_TRUE;
+
while (!open_worker_stop)
{
Eet_File *ef = eet_open((char const *)path, EET_FILE_MODE_READ);
@@ -1858,6 +1862,14 @@ open_close_worker(void *path, Eina_Thread tid
EINA_UNUSED)
if (err_code != EET_ERROR_NONE)
return "eet_close() failed";
}
+
+ if (first)
+ {
+ eina_lock_take(&open_worker_mutex);
+ eina_condition_broadcast(&open_worker_cond);
+ eina_lock_release(&open_worker_mutex);
+ first = EINA_FALSE;
+ }
}
return NULL;
@@ -1876,17 +1888,24 @@ START_TEST(eet_cache_concurrency)
eet_init();
eina_threads_init();
+ eina_lock_new(&open_worker_mutex);
+ eina_condition_new(&open_worker_cond, &open_worker_mutex);
+
/* create a file to test with */
fail_if(!(file = tmpnam(file)));
ef = eet_open(file, EET_FILE_MODE_WRITE);
fail_if(!ef);
fail_if(!eet_write(ef, "keys/tests", buffer, strlen(buffer) + 1, 0));
+ eina_lock_take(&open_worker_mutex);
/* start a thread that repeatedly opens and closes a file */
open_worker_stop = 0;
r = eina_thread_create(&thread, EINA_THREAD_NORMAL, -1, open_close_worker,
file);
fail_unless(r);
+ eina_condition_wait(&open_worker_cond);
+ eina_lock_release(&open_worker_mutex);
+
/* clear the cache repeatedly in this thread */
for (n = 0; n < 20000; ++n)
{
--
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev