wutstdc++: Use OSSetThreadRunQuantum in gthread implementation.

To emulate pre-emptive scheduling which is what would be expected from
gthread.
This commit is contained in:
James Benton 2020-01-18 10:58:02 +00:00
parent a35269d207
commit d39e7cad4a

View File

@ -43,6 +43,11 @@ __wut_thread_create(OSThread **outThread,
*outThread = thread;
OSSetThreadDeallocator(thread, &__wut_thread_deallocator);
OSSetThreadCleanupCallback(thread, &__wut_thread_cleanup);
// Set a thread run quantum to 1 millisecond, to force the threads to
// behave more like pre-emptive scheduling rather than co-operative.
OSSetThreadRunQuantum(thread, 1000);
OSResumeThread(thread);
return 0;
}