diff options
Diffstat (limited to 'tests/test-lock.c')
-rw-r--r-- | tests/test-lock.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/test-lock.c b/tests/test-lock.c index a8fb32f8..b5a5240f 100644 --- a/tests/test-lock.c +++ b/tests/test-lock.c @@ -1,5 +1,5 @@ /* Test of locking in multithreaded situations. - Copyright (C) 2005, 2008-2022 Free Software Foundation, Inc. + Copyright (C) 2005, 2008-2024 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -118,7 +118,7 @@ static int account[ACCOUNT_COUNT]; static int random_account (void) { - return ((unsigned int) rand () >> 3) % ACCOUNT_COUNT; + return ((unsigned long) random () >> 3) % ACCOUNT_COUNT; } static void @@ -143,7 +143,7 @@ check_accounts (void) gl_lock_define_initialized(static, my_lock) static void * -lock_mutator_thread (void *arg) +lock_mutator_thread (_GL_UNUSED void *arg) { int repeat; @@ -157,7 +157,7 @@ lock_mutator_thread (void *arg) i1 = random_account (); i2 = random_account (); - value = ((unsigned int) rand () >> 3) % 10; + value = ((unsigned long) random () >> 3) % 10; account[i1] += value; account[i2] -= value; @@ -181,7 +181,7 @@ lock_mutator_thread (void *arg) static struct atomic_int lock_checker_done; static void * -lock_checker_thread (void *arg) +lock_checker_thread (_GL_UNUSED void *arg) { while (get_atomic_int_value (&lock_checker_done) == 0) { @@ -234,7 +234,7 @@ test_lock (void) gl_rwlock_define_initialized(static, my_rwlock) static void * -rwlock_mutator_thread (void *arg) +rwlock_mutator_thread (_GL_UNUSED void *arg) { int repeat; @@ -248,7 +248,7 @@ rwlock_mutator_thread (void *arg) i1 = random_account (); i2 = random_account (); - value = ((unsigned int) rand () >> 3) % 10; + value = ((unsigned long) random () >> 3) % 10; account[i1] += value; account[i2] -= value; @@ -266,7 +266,7 @@ rwlock_mutator_thread (void *arg) static struct atomic_int rwlock_checker_done; static void * -rwlock_checker_thread (void *arg) +rwlock_checker_thread (_GL_UNUSED void *arg) { while (get_atomic_int_value (&rwlock_checker_done) == 0) { @@ -331,12 +331,12 @@ recshuffle (void) i1 = random_account (); i2 = random_account (); - value = ((unsigned int) rand () >> 3) % 10; + value = ((unsigned long) random () >> 3) % 10; account[i1] += value; account[i2] -= value; /* Recursive with probability 0.5. */ - if (((unsigned int) rand () >> 3) % 2) + if (((unsigned long) random () >> 3) % 2) recshuffle (); dbgprintf ("Mutator %p before unlock\n", gl_thread_self_pointer ()); @@ -345,7 +345,7 @@ recshuffle (void) } static void * -reclock_mutator_thread (void *arg) +reclock_mutator_thread (_GL_UNUSED void *arg) { int repeat; @@ -369,7 +369,7 @@ reclock_mutator_thread (void *arg) static struct atomic_int reclock_checker_done; static void * -reclock_checker_thread (void *arg) +reclock_checker_thread (_GL_UNUSED void *arg) { while (get_atomic_int_value (&reclock_checker_done) == 0) { |