mirror of https://github.com/deavmi/eventy.git
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:
parent
3603c567e8
commit
59d0253b61
|
@ -251,13 +251,15 @@ public final class Engine : Thread
|
||||||
/**
|
/**
|
||||||
* Lock the queue-set
|
* Lock the queue-set
|
||||||
*
|
*
|
||||||
* Additionally:
|
* TODO: Maybe add sleep support here too?
|
||||||
* Don't waste time spinning on mutex,
|
|
||||||
* if it is not lockable then yield
|
|
||||||
*/
|
*/
|
||||||
while (!queueLock.tryLock_nothrow())
|
while (!queueLock.tryLock_nothrow())
|
||||||
{
|
{
|
||||||
yield();
|
// Don't waste time spinning on mutex, yield if failed
|
||||||
|
if(!settings.agressiveTryLock)
|
||||||
|
{
|
||||||
|
yield();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Queue queue; queues)
|
foreach (Queue queue; queues)
|
||||||
|
|
Loading…
Reference in New Issue