You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zero/ZeroLevel/Services/Shedulling/ExpiredAsyncObject.cs

51 lines
1.2 KiB

6 years ago
using System;
using System.Threading;
using System.Threading.Tasks;
namespace ZeroLevel.Services.Shedulling
{
internal class ExpiredAsyncObject
{
private static long _counter = 0;
public ExpiredAsyncObject()
{
Key = Interlocked.Increment(ref _counter);
}
public ExpiredAsyncObject(bool has_no_key)
{
if (has_no_key)
Key = -1;
else
Key = Interlocked.Increment(ref _counter);
}
public ExpiredAsyncObject Reset(DateTime nextDate)
{
ExpirationDate = nextDate;
Next = null;
return this;
}
/// <summary>
/// Action at the end of the wait
6 years ago
/// </summary>
public Func<long, Task> Callback;
6 years ago
/// <summary>
/// Expiration Timeout
6 years ago
/// </summary>
public DateTime ExpirationDate;
6 years ago
/// <summary>
/// Next object with the nearest waiting date
6 years ago
/// </summary>
public ExpiredAsyncObject Next;
6 years ago
/// <summary>
/// Key to identify the pending event
6 years ago
/// </summary>
public long Key { get; }
}
}

Powered by TurnKey Linux.