diff --git a/src/ComputeSharp.Graphics/GraphicsDevice.cs b/src/ComputeSharp.Graphics/GraphicsDevice.cs
index a4177ccc..9a5165b6 100644
--- a/src/ComputeSharp.Graphics/GraphicsDevice.cs
+++ b/src/ComputeSharp.Graphics/GraphicsDevice.cs
@@ -18,11 +18,6 @@ namespace ComputeSharp.Graphics
///
public const Direct3DFeatureLevel FeatureLevel = Direct3DFeatureLevel.Level_12_1;
- ///
- /// The instance used to wait for completion when executing commands
- ///
- private readonly AutoResetEvent AutoResetEvent = new AutoResetEvent(false);
-
///
/// The instance to use for compute operations
///
@@ -126,11 +121,6 @@ namespace ComputeSharp.Graphics
///
internal ID3D12Fence NativeDirectFence { get; }
- ///
- /// The used to lock command list executions
- ///
- private readonly object Lock = new object();
-
///
/// Gets the next fence value for compute operations
///
@@ -174,11 +164,11 @@ namespace ComputeSharp.Graphics
if (fenceValue <= fence.CompletedValue) return;
- lock (Lock)
- {
- fence.SetEventOnCompletion(fenceValue, AutoResetEvent.SafeWaitHandle.DangerousGetHandle());
- AutoResetEvent.WaitOne();
- }
+ using ManualResetEvent fenceEvent = new ManualResetEvent(false);
+
+ fence.SetEventOnCompletion(fenceValue, fenceEvent);
+
+ fenceEvent.WaitOne();
}
///
@@ -244,8 +234,6 @@ namespace ComputeSharp.Graphics
NativeDirectFence.Dispose();
NativeDevice.Dispose();
-
- AutoResetEvent.Dispose();
}
}
}