winpthreads: tests: do not use `pthread_mutex_lock` in *-trylock mutex tests These tests used `pthread_mutex_lock` to initially lock the mutex. Use `pthread_mutex_trylock` 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-trylock.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/default-trylock.c index d7efbe9..a2a1e14 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/default-trylock.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/default-trylock.c
@@ -54,7 +54,7 @@ pthread_t thread; void *result; - assert(pthread_mutex_lock(&mutex) == 0); + assert(pthread_mutex_trylock(&mutex) == 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-trylock.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/errorcheck-trylock.c index 595aadb..cdcc376 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/errorcheck-trylock.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/errorcheck-trylock.c
@@ -55,7 +55,7 @@ pthread_t thread; void *result; - assert(pthread_mutex_lock(&mutex) == 0); + assert(pthread_mutex_trylock(&mutex) == 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-trylock.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/normal-trylock.c index 49af2f6..ef8aefe 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/normal-trylock.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/normal-trylock.c
@@ -46,7 +46,7 @@ pthread_t thread; void *result; - assert(pthread_mutex_lock(&mutex) == 0); + assert(pthread_mutex_trylock(&mutex) == 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-trylock.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/recursive-trylock.c index 5ad4cf9..dbf9fe9 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/recursive-trylock.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/recursive-trylock.c
@@ -55,7 +55,7 @@ pthread_t thread; void *result; - assert(pthread_mutex_lock(&mutex) == 0); + assert(pthread_mutex_trylock(&mutex) == 0); assert(pthread_create(&thread, NULL, ThreadA, &mutex) == 0); assert(pthread_join(thread, &result) == 0); assert(result == &mutex);