mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 11:03:07 +08:00
Refactor package object model.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user