Add more TASK_CTL commands

This commit is contained in:
twinaphex 2016-01-28 09:38:21 +01:00
parent ebcae85452
commit 0764b65dc4
2 changed files with 19 additions and 28 deletions

View File

@ -414,16 +414,6 @@ void rarch_task_push(rarch_task_t *task)
impl_current->push_running(task);
}
void rarch_task_wait(void)
{
impl_current->wait();
}
void rarch_task_reset(void)
{
impl_current->reset();
}
bool rarch_task_find(rarch_task_finder_t func, void *user_data)
{
return impl_current->find(func, user_data);
@ -433,6 +423,12 @@ bool task_ctl(enum task_ctl_state state, void *data)
{
switch (state)
{
case TASK_CTL_RESET:
impl_current->reset();
break;
case TASK_CTL_WAIT:
impl_current->wait();
break;
case TASK_CTL_NONE:
default:
break;

View File

@ -27,7 +27,19 @@ extern "C" {
enum task_ctl_state
{
TASK_CTL_NONE = 0
TASK_CTL_NONE = 0,
/* Blocks until all tasks have finished.
* This must only be called from the main thread. */
TASK_CTL_WAIT,
/* Sends a signal to terminate all the tasks.
*
* This won't terminate the tasks immediately.
* They will finish as soon as possible.
*
* This must only be called from the main thread. */
TASK_CTL_RESET,
};
typedef struct rarch_task rarch_task_t;
@ -98,23 +110,6 @@ void rarch_task_deinit(void);
*/
void rarch_task_check(void);
/**
* @brief Sends a signal to terminate all the tasks.
*
* This function won't terminate the tasks immediately. They will finish as
* soon as possible.
*
* This function must only be called from the main thread.
*/
void rarch_task_reset(void);
/**
* @brief Blocks until all tasks have finished.
*
* This function must only be called from the main thread.
*/
void rarch_task_wait(void);
/**
* @brief Calls func for every running task until it returns true.
*