diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-08-07 23:32:24 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-07 23:32:24 -0300 |
| commit | 0cec4cbee5bbd7b86679eb3c0bb1dcf8ccfb2938 (patch) | |
| tree | 3c320933555451f38e242ae69ebd683ab12670e3 | |
| parent | 827752ec0743af9717b2a6d84c87e6556150d8e5 (diff) | |
Fix race condition on IdDictionary (#333)
| -rw-r--r-- | Ryujinx.HLE/OsHle/IdDictionary.cs | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/Ryujinx.HLE/OsHle/IdDictionary.cs b/Ryujinx.HLE/OsHle/IdDictionary.cs index 7a93f634..dcb8d0f7 100644 --- a/Ryujinx.HLE/OsHle/IdDictionary.cs +++ b/Ryujinx.HLE/OsHle/IdDictionary.cs @@ -8,8 +8,6 @@ namespace Ryujinx.HLE.OsHle { private ConcurrentDictionary<int, object> Objs; - private int FreeIdHint = 1; - public IdDictionary() { Objs = new ConcurrentDictionary<int, object>(); @@ -22,16 +20,6 @@ namespace Ryujinx.HLE.OsHle public int Add(object Data) { - if (Objs.TryAdd(FreeIdHint, Data)) - { - return FreeIdHint++; - } - - return AddSlow(Data); - } - - private int AddSlow(object Data) - { for (int Id = 1; Id < int.MaxValue; Id++) { if (Objs.TryAdd(Id, Data)) @@ -67,8 +55,6 @@ namespace Ryujinx.HLE.OsHle { if (Objs.TryRemove(Id, out object Obj)) { - FreeIdHint = Id; - return Obj; } |
