mirror of
https://github.com/snltty/linker.git
synced 2025-11-01 21:13:04 +08:00
40 lines
870 B
C#
40 lines
870 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace common.libs
|
|
{
|
|
public sealed class LoopTask
|
|
{
|
|
List<TaskInfo> tasks = new List<TaskInfo>();
|
|
public LoopTask()
|
|
{
|
|
Task.Factory.StartNew(async () =>
|
|
{
|
|
while (true)
|
|
{
|
|
foreach (TaskInfo item in tasks)
|
|
{
|
|
|
|
}
|
|
await Task.Delay(15);
|
|
}
|
|
}, TaskCreationOptions.LongRunning);
|
|
}
|
|
|
|
public void AddTask(Action action, int interval)
|
|
{
|
|
|
|
}
|
|
|
|
sealed class TaskInfo
|
|
{
|
|
public Action Action { get; set; }
|
|
public int Interval { get; set; }
|
|
public int Timer { get; set; }
|
|
}
|
|
}
|
|
}
|