eina: make it possible to force the number of detected CPU as way to overcome local bug.

SVN revision: 70328
This commit is contained in:
Cedric BAIL 2012-04-19 09:25:54 +00:00
parent 03ad20b260
commit 5d72c686c7
5 changed files with 26 additions and 1 deletions

View File

@ -250,3 +250,7 @@
* Add missing API eina_file_map_faulted() on Windows. Does nothing
for now.
2012-04-19 Cedric Bail
* Make it possible to force the number of detected CPU on a system.

View File

@ -32,6 +32,7 @@ Fixes:
* forgotten initialization of eina list count during eina_list_split_list.
* leak in Eina_File.
* deadlock in Eina_File.
* make it possible to force the number of detected CPU on a system.
Improvements:

View File

@ -130,7 +130,10 @@ EAPI Eina_Cpu_Features eina_cpu_features_get(void)
return ecf;
}
EAPI int eina_cpu_count(void)
static int _cpu_count = -1;
static int
_eina_cpu_count_internal(void)
{
#ifdef EFL_HAVE_THREADS
@ -205,3 +208,16 @@ EAPI int eina_cpu_count(void)
return 1;
#endif
}
EAPI int eina_cpu_count(void)
{
return _cpu_count;
}
void eina_cpu_count_internal(void)
{
if (getenv("EINA_CPU_FAKE"))
_cpu_count = atoi(getenv("EINA_CPU_FAKE"));
else
_cpu_count = _eina_cpu_count_internal();
}

View File

@ -298,6 +298,8 @@ eina_init(void)
}
}
eina_cpu_count_internal();
_eina_main_count = 1;
return 1;
}

View File

@ -142,6 +142,8 @@ void eina_log_threads_init(void);
void eina_log_threads_shutdown(void);
#endif
void eina_cpu_count_internal(void);
void eina_file_mmap_faulty(void *addr, long page_size);
#endif /* EINA_PRIVATE_H_ */