mirror of
https://github.com/deavmi/eventy.git
synced 2024-09-11 08:22:49 +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:
parent
3603c567e8
commit
59d0253b61
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user