Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Mutex WaitOne(timeout) - what is a good way to arrive at a good timeout interval

$
0
0

Hi,

I have implemented a mutex without a timeout. My understanding of a mutex with timeout, let's say 100 milliseconds, the thread will be blocked for this time, if the code block finishes before the timeout of 100ms, then that will be released anyway.But if the code block takes more than 100 ms, then it would be force it to exit out of the mutex. This means that I would actually need to know how long my code block would ideally need to execute, add some buffer and set the timeout accordingly. Basically, the timeout just safeguards a long running code block or an external factor that it not in the code block's control that is causing it to run slow an extraneous to the code block that it not in it's control.

How do you arrive at a good timeout interval?

Thanks




Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>