forked from enlightenment/efl
+ecore_thread_max_{set,get} to return/set the max number of threads ecore will attempt to run simultaneously
SVN revision: 50397
This commit is contained in:
parent
13399b7362
commit
ec1d528178
|
@ -353,6 +353,8 @@ extern "C" {
|
|||
EAPI int ecore_thread_active_get(void);
|
||||
EAPI int ecore_thread_pending_get(void);
|
||||
EAPI int ecore_thread_pending_long_get(void);
|
||||
EAPI int ecore_thread_max_get(void);
|
||||
EAPI void ecore_thread_max_set(int num);
|
||||
|
||||
|
||||
EAPI double ecore_time_get(void);
|
||||
|
|
|
@ -326,6 +326,10 @@ _ecore_thread_shutdown(void)
|
|||
del_handler = NULL;
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
* @defgroup Ecore_Thread Ecore Thread Functions
|
||||
* These functions allow for ecore-managed threads which integrate with ecore's main loop.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Run some blocking code in a parrallel thread to avoid locking the main loop.
|
||||
|
@ -698,3 +702,32 @@ ecore_thread_pending_long_get(void)
|
|||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the max number of threads that can run simultaneously
|
||||
* @return Max number of threads ecore will run
|
||||
* This returns the total number of threads that ecore will attempt to run
|
||||
* simultaneously.
|
||||
*/
|
||||
EAPI int
|
||||
ecore_thread_max_get(void)
|
||||
{
|
||||
return _ecore_thread_count_max;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the max number of threads that can run simultaneously
|
||||
* @param num The new maximum
|
||||
* This sets the maximum number of threads that ecore will try to run
|
||||
* simultaneously. This number cannot be < 1 or >= 2x the number of active cpus.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_thread_max_set(int num)
|
||||
{
|
||||
if (num < 1) return;
|
||||
/* avoid doing something hilarious by blocking dumb users */
|
||||
if (num >= (2 * eina_cpu_count())) return;
|
||||
|
||||
_ecore_thread_count_max = num;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue