Search code examples
c++winapimutexcritical-sectiontimed

WinAPI timed mutex lock


How to lock mutex (critical section) for some amount of time? Is there any API function for that? As far as I see there is nothing like that in windows. If so, is it possible to implement it manualy?

Thanks.


Solution

  • The equivalent of pthread_mutex_timedlock() in Win32 is using a Mutex and specifying a timeout (other than INFINITE) in one of the wait-functions.