I have written a function f like this:
void f()
{
f1(); // Pre-Work
f2(); // the actual work
f3(); // Post-Work
}
f1 and f3 are my own functions, but f2 comes from a library I have no control of. f is called periodically from some controller.
All works fine, but once a week f2 hangs, and does not return for unknown reasons. What is the design pattern to handle this? Probably, f should be run in an extra Task, or can I use async/await pattern? What is with memory that might be allocated in f2?