I have some code that's already asynchronous - just not using the Task system. I would like to make it a lightweight Task, if possible, so that code may leverage it as a Task.
So I want to take this:
void BeginThing(Action callback);
And turn it into this pseudocode:
Task MyBeginThing() {
Task retval = // what do I do here?
BeginThing(() => retval.Done())
return retval;
}
Is this possible? I don't want to use a mutex and another thread as a solution.