winpthreads: tests: do not use `pthread_mutex_lock` in *-timedlock mutex tests

These tests used `pthread_mutex_lock` to initially lock the mutex.
Use `pthread_mutex_timedlock` instead.

Signed-off-by: Kirill Makurin <maiddaisuki@outlook.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/default-timedlock.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/default-timedlock.c
index 4840558..49e625c 100644
--- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/default-timedlock.c
+++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/default-timedlock.c
@@ -48,12 +48,15 @@
 
 int main(void)
 {
+  struct timespec abstime;
   pthread_mutex_t mutex;
   pthread_t thread;
   void *result;
 
   assert(pthread_mutex_init(&mutex, NULL) == 0);
-  assert(pthread_mutex_lock(&mutex) == 0);
+  assert(clock_gettime(CLOCK_REALTIME, &abstime) == 0);
+  abstime.tv_sec += 1;
+  assert(pthread_mutex_timedlock(&mutex, &abstime) == 0);
   assert(pthread_create(&thread, NULL, ThreadA, &mutex) == 0);
   assert(pthread_join(thread, &result) == 0);
   assert(result == &mutex);
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/errorcheck-timedlock.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/errorcheck-timedlock.c
index 2e0c43b..127661a 100644
--- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/errorcheck-timedlock.c
+++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/errorcheck-timedlock.c
@@ -49,6 +49,7 @@
 
 int main(void)
 {
+  struct timespec abstime;
   pthread_mutexattr_t mutexAttr;
   pthread_mutex_t mutex;
   pthread_t thread;
@@ -60,7 +61,9 @@
   assert(pthread_mutexattr_gettype(&mutexAttr, &mutexType) == 0);
   assert(mutexType == PTHREAD_MUTEX_ERRORCHECK);
   assert(pthread_mutex_init(&mutex, &mutexAttr) == 0);
-  assert(pthread_mutex_lock(&mutex) == 0);
+  assert(clock_gettime(CLOCK_REALTIME, &abstime) == 0);
+  abstime.tv_sec += 1;
+  assert(pthread_mutex_timedlock(&mutex, &abstime) == 0);
   assert(pthread_create(&thread, NULL, ThreadA, &mutex) == 0);
   assert(pthread_join(thread, &result) == 0);
   assert(result == &mutex);
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/normal-timedlock.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/normal-timedlock.c
index a2d5eb4..25ac29c 100644
--- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/normal-timedlock.c
+++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/normal-timedlock.c
@@ -48,6 +48,7 @@
 
 int main(void)
 {
+  struct timespec abstime;
   pthread_mutexattr_t mutexAttr;
   pthread_mutex_t mutex;
   pthread_t thread;
@@ -59,7 +60,9 @@
   assert(pthread_mutexattr_gettype(&mutexAttr, &mutexType) == 0);
   assert(mutexType == PTHREAD_MUTEX_NORMAL);
   assert(pthread_mutex_init(&mutex, &mutexAttr) == 0);
-  assert(pthread_mutex_lock(&mutex) == 0);
+  assert(clock_gettime(CLOCK_REALTIME, &abstime) == 0);
+  abstime.tv_sec += 1;
+  assert(pthread_mutex_timedlock(&mutex, &abstime) == 0);
   assert(pthread_create(&thread, NULL, ThreadA, &mutex) == 0);
   assert(pthread_join(thread, &result) == 0);
   assert(result == &mutex);
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/recursive-timedlock.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/recursive-timedlock.c
index 9ec6e72..0639b88 100644
--- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/recursive-timedlock.c
+++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/recursive-timedlock.c
@@ -49,6 +49,7 @@
 
 int main(void)
 {
+  struct timespec abstime;
   pthread_mutexattr_t mutexAttr;
   pthread_mutex_t mutex;
   pthread_t thread;
@@ -60,7 +61,9 @@
   assert(pthread_mutexattr_gettype(&mutexAttr, &mutexType) == 0);
   assert(mutexType == PTHREAD_MUTEX_RECURSIVE);
   assert(pthread_mutex_init(&mutex, &mutexAttr) == 0);
-  assert(pthread_mutex_lock(&mutex) == 0);
+  assert(clock_gettime(CLOCK_REALTIME, &abstime) == 0);
+  abstime.tv_sec += 1;
+  assert(pthread_mutex_timedlock(&mutex, &abstime) == 0);
   assert(pthread_create(&thread, NULL, ThreadA, &mutex) == 0);
   assert(pthread_join(thread, &result) == 0);
   assert(result == &mutex);