Merge pull request #3766 from heuripedes/master

(task_http) Don't use 100% CPU in threaded mode
This commit is contained in:
Twinaphex 2016-10-09 19:47:04 +02:00 committed by GitHub
commit 9561b55114
2 changed files with 4 additions and 4 deletions

View File

@ -454,10 +454,6 @@ static void threaded_worker(void *userdata)
task_queue_put(&tasks_finished, task);
slock_unlock(finished_lock);
}
#if 0
retro_sleep(10);
#endif
}
}

View File

@ -119,6 +119,10 @@ static int task_http_iterate_transfer(retro_task_t *task)
http_handle_t *http = (http_handle_t*)task->state;
size_t pos = 0, tot = 0;
/* FIXME: This wouldn't be needed if we could wait for a timeout */
if (task_queue_ctl(TASK_QUEUE_CTL_IS_THREADED, NULL))
retro_sleep(1);
if (!net_http_update(http->handle, &pos, &tot))
{
task->progress = (tot == 0) ? -1 : (signed)(pos * 100 / tot);