|
9 | 9 | using System.Collections.Generic; |
10 | 10 | using System.Diagnostics.CodeAnalysis; |
11 | 11 | using System.Runtime.CompilerServices; |
12 | | -using System.Runtime.InteropServices; |
13 | | -using System.Threading; |
14 | 12 | using static System.Runtime.CompilerServices.MethodImplOptions; |
15 | 13 | #if ENABLE_IL2CPP |
16 | 14 | using Unity.IL2CPP.CompilerServices; |
@@ -703,7 +701,7 @@ public void Dispose() { |
703 | 701 | #endif |
704 | 702 | public class MultiComponents<T> where T : struct { |
705 | 703 | #if FFS_ECS_DEBUG |
706 | | - private readonly HashSet<uint> _blocked = new(); |
| 704 | + private readonly System.Collections.Concurrent.ConcurrentDictionary<uint, bool> _blocked = new(); |
707 | 705 | internal MultiThreadStatus mtStatus; |
708 | 706 | #endif |
709 | 707 |
|
@@ -817,17 +815,17 @@ internal static byte SlotCapacityToLevel(uint capacity) { |
817 | 815 | #if FFS_ECS_DEBUG |
818 | 816 | [MethodImpl(AggressiveInlining)] |
819 | 817 | internal bool IsBlocked(ref Multi<T> value) { |
820 | | - return _blocked.Contains(Level.PackSlot(value.blockIdx, value.dataOffset)); |
| 818 | + return _blocked.ContainsKey(Level.PackSlot(value.blockIdx, value.dataOffset)); |
821 | 819 | } |
822 | 820 |
|
823 | 821 | [MethodImpl(AggressiveInlining)] |
824 | 822 | internal void Block(uint blockIdx, byte offset) { |
825 | | - _blocked.Add(Level.PackSlot(blockIdx, offset)); |
| 823 | + _blocked[Level.PackSlot(blockIdx, offset)] = true; |
826 | 824 | } |
827 | 825 |
|
828 | 826 | [MethodImpl(AggressiveInlining)] |
829 | 827 | internal void Unblock(uint blockIdx, byte offset) { |
830 | | - _blocked.Remove(Level.PackSlot(blockIdx, offset)); |
| 828 | + _blocked.TryRemove(Level.PackSlot(blockIdx, offset), out _); |
831 | 829 | } |
832 | 830 | #endif |
833 | 831 | } |
|
0 commit comments