I want to pass somehow delegate to Task, which has to execute some code on variable (AutoResetEvent
) inside this task when requested. Below is pseudo code:
var task = Task.Run(() => DoSth()); + delegate somehow
public async Task DoSth()
{
public static AutoResetEvent waitEvent = new AutoResetEvent(true);
while(true)
{
...
waitEvent.WaitOne(seconds * 1000);
{
}
What this delegate has to do is:
waitEvent.Set();
because I do not want wait 60 seconds.
And at some point tell task to run delegate code.