Skip to content
Permalink
Browse files

Move PooledDelegateHelper outside lock

  • Loading branch information
Eideren authored and xen2 committed Aug 29, 2019
1 parent b6a4833 commit 55371ea340660e34bcfbbd0f6b97f87064fafcee
Showing with 2 additions and 2 deletions.
  1. +2 −2 sources/core/Xenko.Core/Threading/ThreadPool.cs
@@ -42,11 +42,10 @@ public void QueueWorkItem([NotNull] [Pooled] Action workItem)
{
bool lockTaken = false;
bool startNewTask = false;
PooledDelegateHelper.AddReference(workItem);
try
{
spinLock.Enter(ref lockTaken);

PooledDelegateHelper.AddReference(workItem);
workItems.Enqueue(workItem);
workAvailable.Set();

@@ -130,6 +129,7 @@ private void ProcessWorkItems()
{
Interlocked.Decrement(ref busyCount);
}
PooledDelegateHelper.Release(workItem);
lastWorkTS = Stopwatch.GetTimestamp();
}
}

0 comments on commit 55371ea

Please sign in to comment.
You can’t perform that action at this time.