61 switch (WaitForSingleObject(
62 _lock, timeout == 0xFFFFFFF ? INFINITE : (DWORD)timeout))
79 if (timeout == 0xFFFFFFFF)
84 else if (timeout == 0)
93 gettimeofday(&
now,
nullptr);
95 wait_time.tv_sec = timeout / 1000 +
now.tv_sec;
96 wait_time.tv_nsec = (timeout % 1000) * 1000000 +
now.tv_usec * 1000;
98 if (wait_time.tv_nsec >= 1000000000)
101 wait_time.tv_nsec -= 1000000000;
103 switch (pthread_mutex_timedlock(&
_lock, &wait_time))
122 pthread_mutex_unlock(&
_lock);
138 pthread_mutex_init(&
_lock,
nullptr);
150 pthread_mutex_destroy(&
_lock);
157 pthread_mutex_t
_lock;