Refactor package object model.

This commit is contained in:
Christian Kratky
2020-10-28 23:11:12 +01:00
parent adce5662eb
commit b7fb0c1002
71 changed files with 761 additions and 582 deletions
@@ -1,20 +1,25 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
namespace MQTTnet.Implementations
{
public static class PlatformAbstractionLayer
{
public static Task CompletedTask
{
get
{
#if NET452
return Task.FromResult(0);
#else
return Task.CompletedTask;
#endif
}
}
public static readonly byte[] EmptyByteArray = new byte[0];
#if NET452
public static Task CompletedTask => Task.FromResult(0);
#else
public static Task CompletedTask => Task.CompletedTask;
#endif
public static void Sleep(TimeSpan timeout)
{
#if NET452 || NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP3_1
System.Threading.Thread.Sleep(timeout);
#else
Task.Delay(timeout).Wait();
#endif
}
}
}