mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-01 12:26:38 -05:00
Avoid 100% CPU utlization in thread_yield
This commit is contained in:
parent
51df6c2334
commit
ea6aff0e46
1 changed files with 2 additions and 1 deletions
|
|
@ -2972,9 +2972,10 @@ void thread_join(thread_id_t thread, void** retval)
|
||||||
void thread_yield(void)
|
void thread_yield(void)
|
||||||
{
|
{
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
Sleep(0);
|
Sleep(1); /* avoid 100% cpu utilization */
|
||||||
#else
|
#else
|
||||||
sched_yield();
|
sched_yield();
|
||||||
|
usleep(1000); /* avoid 100% cpu utilization */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue