mirror of
https://github.com/snltty/linker.git
synced 2025-10-21 16:19:27 +08:00
sync
This commit is contained in:
@@ -27,7 +27,21 @@ namespace linker.libs
|
||||
}
|
||||
});
|
||||
}
|
||||
public static void SetInterval(Func<Task<bool>> action, int delayMs)
|
||||
public static void SetInterval(Func<bool> action, Func<int> delay)
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (action() == false)
|
||||
{
|
||||
break;
|
||||
}
|
||||
await Task.Delay(delay()).ConfigureAwait(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
public static void SetInterval(Func<Task<bool>> action, Func<int> delay)
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
@@ -37,7 +51,7 @@ namespace linker.libs
|
||||
{
|
||||
break;
|
||||
}
|
||||
await Task.Delay(delayMs).ConfigureAwait(false);
|
||||
await Task.Delay(delay()).ConfigureAwait(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user