winpthreads: tests: reformat pthread_mutex/* tests 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/mutex1.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1.c index 2d8592b..85cd55e 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1.c
@@ -1,4 +1,4 @@ -/* +/* * mutex1.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -37,30 +37,24 @@ * This is the simplest test of the pthread mutex family that we can do. * * Depends on API functions: - * pthread_mutex_init() - * pthread_mutex_lock() - * pthread_mutex_unlock() - * pthread_mutex_destroy() + * pthread_mutex_init() + * pthread_mutex_lock() + * pthread_mutex_unlock() + * pthread_mutex_destroy() */ #include "test.h" -int -main() +int main(void) { static pthread_mutex_t mutex; assert(pthread_mutex_init(&mutex, NULL) == 0); - assert(mutex); - assert(pthread_mutex_lock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_destroy(&mutex) == 0); - assert(!mutex); - + return 0; }
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1e.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1e.c index 9fbdc85..39f5d17 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1e.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1e.c
@@ -1,4 +1,4 @@ -/* +/* * mutex1e.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -39,34 +39,27 @@ * This is the simplest test of the pthread mutex family that we can do. * * Depends on API functions: - * pthread_mutexattr_settype() - * pthread_mutex_init() - * pthread_mutex_destroy() + * pthread_mutexattr_settype() + * pthread_mutex_init() + * pthread_mutex_destroy() */ #include "test.h" -int -main() +int main(void) { static pthread_mutexattr_t mxAttr; assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_ERRORCHECK) == 0); static pthread_mutex_t mutex; assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - assert(mutex); - assert(pthread_mutex_lock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_destroy(&mutex) == 0); - assert(!mutex); return 0;
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1n.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1n.c index 9e486e5..902303a 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1n.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1n.c
@@ -1,4 +1,4 @@ -/* +/* * mutex1n.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -39,34 +39,27 @@ * This is the simplest test of the pthread mutex family that we can do. * * Depends on API functions: - * pthread_mutexattr_settype() - * pthread_mutex_init() - * pthread_mutex_destroy() + * pthread_mutexattr_settype() + * pthread_mutex_init() + * pthread_mutex_destroy() */ #include "test.h" -int -main() +int main(void) { static pthread_mutexattr_t mxAttr; assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_NORMAL) == 0); static pthread_mutex_t mutex; assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - assert(mutex); - assert(pthread_mutex_lock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_destroy(&mutex) == 0); - assert(!mutex); return 0;
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1r.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1r.c index c7c1573..0f95b86 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1r.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex1r.c
@@ -1,4 +1,4 @@ -/* +/* * mutex1r.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -39,34 +39,27 @@ * This is the simplest test of the pthread mutex family that we can do. * * Depends on API functions: - * pthread_mutexattr_settype() - * pthread_mutex_init() - * pthread_mutex_destroy() + * pthread_mutexattr_settype() + * pthread_mutex_init() + * pthread_mutex_destroy() */ #include "test.h" -int -main() +int main(void) { static pthread_mutexattr_t mxAttr; assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_RECURSIVE) == 0); static pthread_mutex_t mutex; assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - assert(mutex); - assert(pthread_mutex_lock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_destroy(&mutex) == 0); - assert(!mutex); return 0;
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex2.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex2.c index 41fd0dd..c84928b 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex2.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex2.c
@@ -1,4 +1,4 @@ -/* +/* * mutex2.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -33,20 +33,19 @@ * * -------------------------------------------------------------------------- * - * Declare a static mutex object, lock it, + * Declare a static mutex object, lock it, * and then unlock it again. * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_mutex_lock() + * pthread_mutex_unlock() */ #include "test.h" - + pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; -int -main() +int main(void) { assert(mutex == PTHREAD_MUTEX_INITIALIZER); fprintf (stderr, "Try lock\n"); @@ -55,7 +54,6 @@ fprintf(stderr, "Mutex locked\n"); assert(mutex != PTHREAD_MUTEX_INITIALIZER); - assert(mutex); assert(pthread_mutex_unlock(&mutex) == 0);
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex2e.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex2e.c index e5cf3e2..1fdd8ad 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex2e.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex2e.c
@@ -1,4 +1,4 @@ -/* +/* * mutex2e.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -33,33 +33,26 @@ * * -------------------------------------------------------------------------- * - * Declare a static mutex object, lock it, + * Declare a static mutex object, lock it, * and then unlock it again. * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_mutex_lock() + * pthread_mutex_unlock() */ #include "test.h" - + pthread_mutex_t mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER; -int -main() +int main(void) { assert(mutex == PTHREAD_ERRORCHECK_MUTEX_INITIALIZER); - assert(pthread_mutex_lock(&mutex) == 0); - assert(mutex != PTHREAD_ERRORCHECK_MUTEX_INITIALIZER); - assert(mutex); - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_destroy(&mutex) == 0); - assert(!mutex); return 0;
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex2r.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex2r.c index 4f4d068..bc0b3d4 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex2r.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex2r.c
@@ -1,4 +1,4 @@ -/* +/* * mutex2r.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -33,33 +33,26 @@ * * -------------------------------------------------------------------------- * - * Declare a static mutex object, lock it, + * Declare a static mutex object, lock it, * and then unlock it again. * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_mutex_lock() + * pthread_mutex_unlock() */ #include "test.h" - + pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; -int -main() +int main(void) { assert(mutex == PTHREAD_RECURSIVE_MUTEX_INITIALIZER); - assert(pthread_mutex_lock(&mutex) == 0); - assert(mutex != PTHREAD_RECURSIVE_MUTEX_INITIALIZER); - assert(mutex); - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_destroy(&mutex) == 0); - assert(!mutex); return 0;
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex3.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex3.c index bc1429e..e36ff85 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex3.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex3.c
@@ -1,4 +1,4 @@ -/* +/* * mutex3.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -33,42 +33,36 @@ * * -------------------------------------------------------------------------- * - * Declare a static mutex object, lock it, trylock it, + * Declare a static mutex object, lock it, trylock it, * and then unlock it again. * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_mutex_lock() + * pthread_mutex_trylock() + * pthread_mutex_unlock() */ #include "test.h" - + pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; static int washere = 0; -void * func(void * arg) +void *func(void *arg) { assert(pthread_mutex_trylock(&mutex1) == EBUSY); - washere = 1; - - return 0; + return 0; } - -int -main() + +int main(void) { pthread_t t; assert(pthread_mutex_lock(&mutex1) == 0); - assert(pthread_create(&t, NULL, func, NULL) == 0); assert(pthread_join(t, NULL) == 0); - assert(pthread_mutex_unlock(&mutex1) == 0); - assert(washere == 1); return 0;
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex3e.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex3e.c index 66cfcb7..b4a02b6 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex3e.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex3e.c
@@ -1,4 +1,4 @@ -/* +/* * mutex3e.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -33,42 +33,36 @@ * * -------------------------------------------------------------------------- * - * Declare a static mutex object, lock it, trylock it, + * Declare a static mutex object, lock it, trylock it, * and then unlock it again. * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_mutex_lock() + * pthread_mutex_trylock() + * pthread_mutex_unlock() */ #include "test.h" - + pthread_mutex_t mutex1 = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER; static int washere = 0; -void * func(void * arg) +void *func(void *arg) { assert(pthread_mutex_trylock(&mutex1) == EBUSY); - washere = 1; - - return 0; + return 0; } - -int -main() + +int main(void) { pthread_t t; assert(pthread_mutex_lock(&mutex1) == 0); - assert(pthread_create(&t, NULL, func, NULL) == 0); assert(pthread_join(t, NULL) == 0); - assert(pthread_mutex_unlock(&mutex1) == 0); - assert(washere == 1); return 0;
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex3r.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex3r.c index 8fa7f25..e789c64 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex3r.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex3r.c
@@ -1,4 +1,4 @@ -/* +/* * mutex3r.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -33,42 +33,36 @@ * * -------------------------------------------------------------------------- * - * Declare a static mutex object, lock it, trylock it, + * Declare a static mutex object, lock it, trylock it, * and then unlock it again. * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_mutex_lock() + * pthread_mutex_trylock() + * pthread_mutex_unlock() */ #include "test.h" - + pthread_mutex_t mutex1 = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; static int washere = 0; -void * func(void * arg) +void *func(void *arg) { assert(pthread_mutex_trylock(&mutex1) == EBUSY); - washere = 1; - - return 0; + return 0; } - -int -main() + +int main(void) { pthread_t t; assert(pthread_mutex_lock(&mutex1) == 0); - assert(pthread_create(&t, NULL, func, NULL) == 0); assert(pthread_join(t, NULL) == 0); - assert(pthread_mutex_unlock(&mutex1) == 0); - assert(washere == 1); return 0;
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex4.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex4.c index 38342b5..ffb3e4c 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex4.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex4.c
@@ -1,4 +1,4 @@ -/* +/* * mutex4.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -35,10 +35,10 @@ * * Thread A locks mutex - thread B tries to unlock. * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_mutex_lock() + * pthread_mutex_trylock() + * pthread_mutex_unlock() */ #include "test.h" @@ -46,21 +46,23 @@ static int wasHere = 0; static pthread_mutex_t mutex1; - -void * unlocker(void * arg) + +void *unlocker(void *arg) { int expectedResult = (int) (size_t) arg; int h; + wasHere++; h = pthread_mutex_unlock(&mutex1); - printf("*** %d==%d\n\n", h, expectedResult); fflush(stdout); + printf("*** %d==%d\n\n", h, expectedResult); + fflush(stdout); assert(h == expectedResult); wasHere++; + return NULL; } - -int -main() + +int main(void) { pthread_t t; pthread_mutexattr_t ma;
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex5.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex5.c index a71f9d8..46f6fc0 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex5.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex5.c
@@ -1,4 +1,4 @@ -/* +/* * mutex5.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -45,8 +45,7 @@ int _optimiseFoil; #define FOIL(x) (_optimiseFoil = x) -int -main() +int main(void) { int mxType = -1;
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6.c index 267c0c0..2b2aa29 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6.c
@@ -1,4 +1,4 @@ -/* +/* * mutex6.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -38,10 +38,10 @@ * Thread locks mutex twice (recursive lock). * Locking thread should deadlock on second attempt. * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_mutex_lock() + * pthread_mutex_trylock() + * pthread_mutex_unlock() */ #include "test.h" @@ -50,7 +50,7 @@ static pthread_mutex_t mutex; -void * locker(void * arg) +void *locker(void *arg) { assert(pthread_mutex_lock(&mutex) == 0); InterlockedIncrement((long *)&lockCount); @@ -62,9 +62,8 @@ return 0; } - -int -main() + +int main(void) { pthread_t t;
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6e.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6e.c index 66fce09..f786781 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6e.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6e.c
@@ -1,4 +1,4 @@ -/* +/* * mutex6e.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -38,17 +38,17 @@ * This should fail with an EDEADLK error. * The second unlock attempt should fail with an EPERM error. * - * Depends on API functions: - * pthread_create() - * pthread_join() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_create() + * pthread_join() + * pthread_mutexattr_init() + * pthread_mutexattr_destroy() + * pthread_mutexattr_settype() + * pthread_mutexattr_gettype() + * pthread_mutex_init() + * pthread_mutex_destroy() + * pthread_mutex_lock() + * pthread_mutex_unlock() */ #include "test.h" @@ -58,7 +58,7 @@ static pthread_mutex_t mutex; static pthread_mutexattr_t mxAttr; -void * locker(void * arg) +void *locker(void *arg) { assert(pthread_mutex_lock(&mutex) == 0); lockCount++; @@ -69,9 +69,8 @@ return (void *) 555; } - -int -main() + +int main(void) { pthread_t t; intptr_t result = 0; @@ -99,4 +98,3 @@ /* Never reached */ return 0; } -
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6es.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6es.c index 6f11ce2..59718e6 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6es.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6es.c
@@ -1,4 +1,4 @@ -/* +/* * mutex6es.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -38,17 +38,17 @@ * This should fail with an EDEADLK error. * The second unlock attempt should fail with an EPERM error. * - * Depends on API functions: - * pthread_create() - * pthread_join() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_create() + * pthread_join() + * pthread_mutexattr_init() + * pthread_mutexattr_destroy() + * pthread_mutexattr_settype() + * pthread_mutexattr_gettype() + * pthread_mutex_init() + * pthread_mutex_destroy() + * pthread_mutex_lock() + * pthread_mutex_unlock() */ #include "test.h" @@ -57,7 +57,7 @@ static pthread_mutex_t mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER; -void * locker(void * arg) +void *locker(void *arg) { assert(pthread_mutex_lock(&mutex) == 0); lockCount++; @@ -68,9 +68,8 @@ return (void *) 555; } - -int -main() + +int main(void) { pthread_t t; intptr_t result = 0; @@ -78,10 +77,8 @@ assert(mutex == PTHREAD_ERRORCHECK_MUTEX_INITIALIZER); assert(pthread_create(&t, NULL, locker, NULL) == 0); - assert(pthread_join(t, (void **) &result) == 0); assert(result == 555); - assert(lockCount == 2); assert(pthread_mutex_destroy(&mutex) == 0); @@ -91,4 +88,3 @@ /* Never reached */ return 0; } -
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6n.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6n.c index 9b4bbb9..267bcb8 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6n.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6n.c
@@ -1,4 +1,4 @@ -/* +/* * mutex6n.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -37,14 +37,14 @@ * Thread locks mutex twice (recursive lock). * The thread should deadlock. * - * Depends on API functions: - * pthread_create() - * pthread_mutexattr_init() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_lock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_create() + * pthread_mutexattr_init() + * pthread_mutexattr_settype() + * pthread_mutexattr_gettype() + * pthread_mutex_init() + * pthread_mutex_lock() + * pthread_mutex_unlock() */ #include "test.h" @@ -54,7 +54,7 @@ static pthread_mutex_t mutex; static pthread_mutexattr_t mxAttr; -void * locker(void * arg) +void *locker(void *arg) { assert(pthread_mutex_lock(&mutex) == 0); lockCount++; @@ -66,9 +66,8 @@ return (void *) 555; } - -int -main() + +int main(void) { pthread_t t; int mxType = -1; @@ -101,4 +100,3 @@ /* Never reached */ return 0; } -
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6r.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6r.c index 4206d98..cb96016 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6r.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6r.c
@@ -1,4 +1,4 @@ -/* +/* * mutex6r.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -37,17 +37,17 @@ * Thread locks mutex twice (recursive lock). * Both locks and unlocks should succeed. * - * Depends on API functions: - * pthread_create() - * pthread_join() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_create() + * pthread_join() + * pthread_mutexattr_init() + * pthread_mutexattr_destroy() + * pthread_mutexattr_settype() + * pthread_mutexattr_gettype() + * pthread_mutex_init() + * pthread_mutex_destroy() + * pthread_mutex_lock() + * pthread_mutex_unlock() */ #include "test.h" @@ -57,7 +57,7 @@ static pthread_mutex_t mutex; static pthread_mutexattr_t mxAttr; -void * locker(void * arg) +void *locker(void *arg) { assert(pthread_mutex_lock(&mutex) == 0); lockCount++; @@ -68,9 +68,8 @@ return (void *) 555; } - -int -main() + +int main(void) { pthread_t t; intptr_t result = 0; @@ -84,10 +83,8 @@ assert(pthread_mutex_init(&mutex, &mxAttr) == 0); assert(pthread_create(&t, NULL, locker, NULL) == 0); - assert(pthread_join(t, (void **) &result) == 0); assert(result == 555); - assert(lockCount == 2); assert(pthread_mutex_destroy(&mutex) == 0);
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6rs.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6rs.c index 9fdeb2a..b8f1e82 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6rs.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6rs.c
@@ -1,4 +1,4 @@ -/* +/* * mutex6rs.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -37,17 +37,17 @@ * Thread locks mutex twice (recursive lock). * Both locks and unlocks should succeed. * - * Depends on API functions: - * pthread_create() - * pthread_join() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_create() + * pthread_join() + * pthread_mutexattr_init() + * pthread_mutexattr_destroy() + * pthread_mutexattr_settype() + * pthread_mutexattr_gettype() + * pthread_mutex_init() + * pthread_mutex_destroy() + * pthread_mutex_lock() + * pthread_mutex_unlock() */ #include "test.h" @@ -56,7 +56,7 @@ static pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; -void * locker(void * arg) +void *locker(void *arg) { assert(pthread_mutex_lock(&mutex) == 0); lockCount++; @@ -67,9 +67,8 @@ return (void *) 555; } - -int -main() + +int main(void) { pthread_t t; intptr_t result = 0; @@ -77,10 +76,8 @@ assert(mutex == PTHREAD_RECURSIVE_MUTEX_INITIALIZER); assert(pthread_create(&t, NULL, locker, NULL) == 0); - assert(pthread_join(t, (void **) &result) == 0); assert(result == 555); - assert(lockCount == 2); assert(pthread_mutex_destroy(&mutex) == 0);
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6s.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6s.c index 8b82dc3..6165bdd 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6s.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex6s.c
@@ -1,4 +1,4 @@ -/* +/* * mutex6s.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -38,10 +38,10 @@ * Thread locks mutex twice (recursive lock). * Locking thread should deadlock on second attempt. * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_mutex_lock() + * pthread_mutex_trylock() + * pthread_mutex_unlock() */ #include "test.h" @@ -50,7 +50,7 @@ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; -void * locker(void * arg) +void *locker(void *arg) { assert(pthread_mutex_lock(&mutex) == 0); lockCount++; @@ -62,9 +62,8 @@ return 0; } - -int -main() + +int main(void) { pthread_t t;
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7.c index f64f06c..70ac116 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7.c
@@ -1,4 +1,4 @@ -/* +/* * mutex7.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -38,10 +38,10 @@ * Thread locks then trylocks mutex (attempted recursive lock). * The thread should lock first time and EBUSY second time. * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_mutex_lock() + * pthread_mutex_trylock() + * pthread_mutex_unlock() */ #include "test.h" @@ -68,18 +68,14 @@ return 0; } - -int -main() + +int main(void) { pthread_t t; assert(pthread_mutex_init(&mutex, NULL) == 0); - assert(pthread_create(&t, NULL, locker, NULL) == 0); - Sleep(1000); - assert(lockCount == 2); exit(0);
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7e.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7e.c index e944ebb..0068150 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7e.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7e.c
@@ -1,4 +1,4 @@ -/* +/* * mutex7e.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -38,17 +38,17 @@ * Trylock should fail with an EBUSY error. * The second unlock attempt should fail with an EPERM error. * - * Depends on API functions: - * pthread_create() - * pthread_join() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_create() + * pthread_join() + * pthread_mutexattr_init() + * pthread_mutexattr_destroy() + * pthread_mutexattr_settype() + * pthread_mutexattr_gettype() + * pthread_mutex_init() + * pthread_mutex_destroy() + * pthread_mutex_lock() + * pthread_mutex_unlock() */ #include "test.h" @@ -58,7 +58,7 @@ static pthread_mutex_t mutex; static pthread_mutexattr_t mxAttr; -void * locker(void * arg) +void *locker(void *arg) { assert(pthread_mutex_lock(&mutex) == 0); lockCount++; @@ -69,9 +69,8 @@ return (void *) 555; } - -int -main() + +int main(void) { pthread_t t; intptr_t result = 0; @@ -85,10 +84,8 @@ assert(pthread_mutex_init(&mutex, &mxAttr) == 0); assert(pthread_create(&t, NULL, locker, NULL) == 0); - assert(pthread_join(t, (void **) &result) == 0); assert(result == 555); - assert(lockCount == 2); assert(pthread_mutex_destroy(&mutex) == 0); @@ -99,4 +96,3 @@ /* Never reached */ return 0; } -
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7n.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7n.c index b703f1d..10b8399 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7n.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7n.c
@@ -1,4 +1,4 @@ -/* +/* * mutex7n.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -37,14 +37,14 @@ * Thread locks then trylocks mutex (attempted recursive lock). * The thread should lock first time and EBUSY second time. * - * Depends on API functions: - * pthread_create() - * pthread_mutexattr_init() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_lock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_create() + * pthread_mutexattr_init() + * pthread_mutexattr_settype() + * pthread_mutexattr_gettype() + * pthread_mutex_init() + * pthread_mutex_lock() + * pthread_mutex_unlock() */ #include "test.h" @@ -54,7 +54,7 @@ static pthread_mutex_t mutex; static pthread_mutexattr_t mxAttr; -void * locker(void * arg) +void *locker(void *arg) { assert(pthread_mutex_lock(&mutex) == 0); lockCount++; @@ -72,9 +72,8 @@ return (void *) 555; } - -int -main() + +int main(void) { pthread_t t; int mxType = -1; @@ -87,9 +86,7 @@ assert(pthread_mutex_init(&mutex, &mxAttr) == 0); assert(pthread_create(&t, NULL, locker, NULL) == 0); - Sleep(1000); - assert(lockCount == 2); exit(0); @@ -97,4 +94,3 @@ /* Never reached */ return 0; } -
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7r.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7r.c index 35495ef..2de774d 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7r.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex7r.c
@@ -1,4 +1,4 @@ -/* +/* * mutex7r.c * * @@ -7,25 +7,25 @@ * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors - * + * * Contact Email: rpj@callisto.canberra.edu.au - * + * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., @@ -37,17 +37,17 @@ * Thread locks mutex then trylocks mutex (recursive lock twice). * Both locks and unlocks should succeed. * - * Depends on API functions: - * pthread_create() - * pthread_join() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_unlock() + * Depends on API functions: + * pthread_create() + * pthread_join() + * pthread_mutexattr_init() + * pthread_mutexattr_destroy() + * pthread_mutexattr_settype() + * pthread_mutexattr_gettype() + * pthread_mutex_init() + * pthread_mutex_destroy() + * pthread_mutex_lock() + * pthread_mutex_unlock() */ #include "test.h" @@ -57,7 +57,7 @@ static pthread_mutex_t mutex; static pthread_mutexattr_t mxAttr; -void * locker(void * arg) +void *locker(void *arg) { assert(pthread_mutex_lock(&mutex) == 0); lockCount++; @@ -68,9 +68,8 @@ return (void *) 555; } - -int -main() + +int main(void) { pthread_t t; intptr_t result = 0; @@ -84,10 +83,8 @@ assert(pthread_mutex_init(&mutex, &mxAttr) == 0); assert(pthread_create(&t, NULL, locker, NULL) == 0); - assert(pthread_join(t, (void **) &result) == 0); assert(result == 555); - assert(lockCount == 2); assert(pthread_mutex_destroy(&mutex) == 0);
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8.c index 5ca9982..f4988a8 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8.c
@@ -1,4 +1,4 @@ -/* +/* * mutex8.c * * @@ -29,9 +29,9 @@ * Timed thread should timeout. * * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_timedlock() - * pthread_mutex_unlock() + * pthread_mutex_lock() + * pthread_mutex_timedlock() + * pthread_mutex_unlock() */ #include "test.h" @@ -41,39 +41,32 @@ static pthread_mutex_t mutex; -void * locker(void * arg) +void *locker(void *arg) { - struct timespec abstime = { 0, 0 }; + struct timespec abstime = {0, 0}; struct _timeb currSysTime; const DWORD NANOSEC_PER_MILLISEC = 1000000; _ftime(&currSysTime); - abstime.tv_sec = currSysTime.time; abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - abstime.tv_sec += 1; assert(pthread_mutex_timedlock(&mutex, &abstime) == ETIMEDOUT); - lockCount++; return 0; } -int -main() +int main(void) { pthread_t t; assert(pthread_mutex_init(&mutex, NULL) == 0); - assert(pthread_mutex_lock(&mutex) == 0); assert(pthread_create(&t, NULL, locker, NULL) == 0); - Sleep(2000); - assert(lockCount == 1); assert(pthread_mutex_unlock(&mutex) == 0);
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8e.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8e.c index b99d24e..a55fb9e 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8e.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8e.c
@@ -1,4 +1,4 @@ -/* +/* * mutex8e.c * * @@ -29,16 +29,16 @@ * Timed thread should timeout. * * Depends on API functions: - * pthread_create() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_timedlock() - * pthread_mutex_unlock() + * pthread_create() + * pthread_mutexattr_init() + * pthread_mutexattr_destroy() + * pthread_mutexattr_settype() + * pthread_mutexattr_gettype() + * pthread_mutex_init() + * pthread_mutex_destroy() + * pthread_mutex_lock() + * pthread_mutex_timedlock() + * pthread_mutex_unlock() */ #include "test.h" @@ -49,28 +49,24 @@ static pthread_mutex_t mutex; static pthread_mutexattr_t mxAttr; -void * locker(void * arg) +void *locker(void *arg) { struct timespec abstime = { 0, 0 }; struct _timeb currSysTime; const DWORD NANOSEC_PER_MILLISEC = 1000000; _ftime(&currSysTime); - abstime.tv_sec = currSysTime.time; abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - abstime.tv_sec += 1; assert(pthread_mutex_timedlock(&mutex, &abstime) == ETIMEDOUT); - lockCount++; return 0; } -int -main() +int main(void) { pthread_t t; int mxType = -1; @@ -81,17 +77,13 @@ assert(mxType == PTHREAD_MUTEX_ERRORCHECK); assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - assert(pthread_mutex_lock(&mutex) == 0); assert(pthread_create(&t, NULL, locker, NULL) == 0); - Sleep(2000); - assert(lockCount == 1); assert(pthread_mutex_unlock(&mutex) == 0); return 0; } -
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8n.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8n.c index 3cfdae6..27b1690 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8n.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8n.c
@@ -29,16 +29,16 @@ * Timed thread should timeout. * * Depends on API functions: - * pthread_create() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_timedlock() - * pthread_mutex_unlock() + * pthread_create() + * pthread_mutexattr_init() + * pthread_mutexattr_destroy() + * pthread_mutexattr_settype() + * pthread_mutexattr_gettype() + * pthread_mutex_init() + * pthread_mutex_destroy() + * pthread_mutex_lock() + * pthread_mutex_timedlock() + * pthread_mutex_unlock() */ #include "test.h" @@ -49,28 +49,24 @@ static pthread_mutex_t mutex; static pthread_mutexattr_t mxAttr; -void * locker(void * arg) +void *locker(void *arg) { struct timespec abstime = { 0, 0 }; struct _timeb currSysTime; const DWORD NANOSEC_PER_MILLISEC = 1000000; _ftime(&currSysTime); - abstime.tv_sec = currSysTime.time; abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - abstime.tv_sec += 1; assert(pthread_mutex_timedlock(&mutex, &abstime) == ETIMEDOUT); - lockCount++; return 0; } -int -main() +int main(void) { pthread_t t; int mxType = -1; @@ -81,17 +77,13 @@ assert(mxType == PTHREAD_MUTEX_NORMAL); assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - assert(pthread_mutex_lock(&mutex) == 0); assert(pthread_create(&t, NULL, locker, NULL) == 0); - Sleep(2000); - assert(lockCount == 1); assert(pthread_mutex_unlock(&mutex) == 0); return 0; } -
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8r.c b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8r.c index d1328ca..5940859 100644 --- a/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8r.c +++ b/mingw-w64-libraries/winpthreads/tests/pthread_mutex/mutex8r.c
@@ -1,4 +1,4 @@ -/* +/* * mutex8r.c * * @@ -29,16 +29,16 @@ * Timed thread should timeout. * * Depends on API functions: - * pthread_create() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_timedlock() - * pthread_mutex_unlock() + * pthread_create() + * pthread_mutexattr_init() + * pthread_mutexattr_destroy() + * pthread_mutexattr_settype() + * pthread_mutexattr_gettype() + * pthread_mutex_init() + * pthread_mutex_destroy() + * pthread_mutex_lock() + * pthread_mutex_timedlock() + * pthread_mutex_unlock() */ #include "test.h" @@ -49,28 +49,24 @@ static pthread_mutex_t mutex; static pthread_mutexattr_t mxAttr; -void * locker(void * arg) +void *locker(void *arg) { struct timespec abstime = { 0, 0 }; struct _timeb currSysTime; const DWORD NANOSEC_PER_MILLISEC = 1000000; _ftime(&currSysTime); - abstime.tv_sec = currSysTime.time; abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - abstime.tv_sec += 1; assert(pthread_mutex_timedlock(&mutex, &abstime) == ETIMEDOUT); - lockCount++; return 0; } -int -main() +int main(void) { pthread_t t; int mxType = -1; @@ -81,17 +77,13 @@ assert(mxType == PTHREAD_MUTEX_RECURSIVE); assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - assert(pthread_mutex_lock(&mutex) == 0); assert(pthread_create(&t, NULL, locker, NULL) == 0); - Sleep(2000); - assert(lockCount == 1); assert(pthread_mutex_unlock(&mutex) == 0); return 0; } -