1
0
mirror of https://github.com/deavmi/eventy.git synced 2024-07-27 08:30:28 +02:00

Implemented agressiveTryLock check so the user can choose whether or not to yield if a fail to grab the lock occurs

This commit is contained in:
Tristan B. Velloza Kildaire 2022-11-26 17:26:05 +02:00
parent 3603c567e8
commit 59d0253b61

View File

@ -251,13 +251,15 @@ public final class Engine : Thread
/**
* Lock the queue-set
*
* Additionally:
* Don't waste time spinning on mutex,
* if it is not lockable then yield
* TODO: Maybe add sleep support here too?
*/
while (!queueLock.tryLock_nothrow())
{
yield();
// Don't waste time spinning on mutex, yield if failed
if(!settings.agressiveTryLock)
{
yield();
}
}
foreach (Queue queue; queues)