Answer the question
In order to leave comments, you need to log in
Is there an implementation of some kind of managed asynchronous thread?
It is necessary to execute the thread asynchronously, in this thread there must be a time delay that needs to be changed. The thread must: run; stop; pause with the option to continue.
Answer the question
In order to leave comments, you need to log in
So start a thread and perform a cyclic operation in it.
1. If you need to complete, check the variable
while (isActiveThread)
{
// действие
}
event.WaitOne(1000); // Ждем сигнального или 1 сек.
If you use TPL, then for example this is possible.
async Task Foo() {}
async Task Foo2()
{
var task = Foo();
if (await Task.WhenAny(task, Task.Delay(1000)) == task)
{
// задача успела выполниться за таймаут
}
else
{
// задача не успела выполниться за таймаут
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question