Skip to content

Commit

Permalink
[Unity3D-sdk] No ConcurrentDictionary duplicates
Browse files Browse the repository at this point in the history
ConcurrentDictionary is released in .NET 4 and it is present in modern Unity API compatibility levels: .NET 4.x and .NET Standard 2.x. It's missed in legacy API compatibility levels: .NET 2.0 and .NET 2.0 Subset.

This commit proposes to add custom implementation of ConcurrentDictionary for legacy API compatibility levels, and use the existing ConcurrentDictionary for modern API compatibility levels.

I also remove the usage of define UNITY_WSA, because it only produces compile errors when build WSA, and because Poco-SDK doesn't build to WSA at all (due to System.Net.Sockets cannot be used for WSA, so TcpServer cannot be compiled).
  • Loading branch information
KorneiDontsov committed Jan 18, 2023
1 parent 4a9e388 commit 1f2dd8d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Unity3D/ConcurrentDictionary.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !UNITY_WSA
#if !UNITY_5_6_OR_NEWER || NET_2_0 || NET_2_0_SUBSET
using System;
using System.Collections;
using System.Collections.Generic;
Expand All @@ -8,7 +8,7 @@
using System.Runtime.Serialization;
using System.Threading;

namespace TcpServer
namespace System.Collections.Concurrent
{

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions Unity3D/PocoManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Newtonsoft.Json.Linq;
using Poco;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
Expand Down
1 change: 1 addition & 0 deletions Unity3D/TcpServer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Threading;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Net;
Expand Down

0 comments on commit 1f2dd8d

Please sign in to comment.