File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
api/AltV.Net.Client/Elements/Pools Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1- using AltV . Net . Client . Elements . Interfaces ;
1+ using System . Collections . Concurrent ;
2+ using AltV . Net . Client . Elements . Interfaces ;
23
34namespace AltV . Net . Client . Elements . Pools
45{
56 public class TimerPool : ITimerPool
67 {
78 private uint lastId ;
8- private readonly Dictionary < uint , IModuleTimer > timers = new ( ) ;
9+ private readonly ConcurrentDictionary < uint , IModuleTimer > timers = new ( ) ;
910
1011 public static long GetTime ( )
1112 {
@@ -30,13 +31,13 @@ public void Tick(string resourceName)
3031 public uint Add ( IModuleTimer timer )
3132 {
3233 var id = lastId ++ ;
33- timers . Add ( id , timer ) ;
34+ timers . TryAdd ( id , timer ) ;
3435 return id ;
3536 }
3637
3738 public void Remove ( uint id )
3839 {
39- timers . Remove ( id ) ;
40+ timers . TryRemove ( id , out _ ) ;
4041 }
4142 }
4243}
You can’t perform that action at this time.
0 commit comments