I have a blocking function, sometimes it hangs indefinitly, it is not cpu bound, it's accessing something externaly also it's a call to unmanaged code. I would like this to work on Windows or Unix
What is the best practice for running this method with a timeout? I assume this will involve running a new thread and having a wait event. I'm after the most lightweight in terms of both lines of code and cpu.
Thanks