我有功能,它开始新的任务:
private async Task GetCamera()
{
....
await Task.Run(async () => await MyAwesomeTask());//eternal cycle
int a=10;//how start without waiting for the end of the thread?
int b=15;
SomeFunction(a,b);
}
private async Task MyAwesomeTask()
{
while (true)
{
await Task.Delay(TimeSpan.FromSeconds(0.5));
//some task
}
}
但是下一行 (int a=10;) 等待 Task 结束。我需要,那 (int a=10;)不要等待,然后继续。我应该怎么办?