Commit a5031f7e8c for openssl.org
commit a5031f7e8cedb975628901130ab18ee9a212e655
Author: Bob Beck <beck@openssl.org>
Date: Sun Aug 16 15:51:27 2026 -0700
Make the low contention torture writers write
OSSL_sleep() takes milliseconds, so the contention == 0 path slept a
second between writes and the low contention tests managed six writes
each in their four second budget. The readers spun tens of millions of
times over a value that was not changing.
Sleep a millisecond instead. In the same four seconds torture_rw_low
goes from 6 writes to 4940, and torture_rcu_low from 6 to 6344.
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Merge-date: Tue Sep 1 14:17:19 2026
Merged-from: https://github.com/openssl/openssl/pull/32404
diff --git a/test/threadstest.c b/test/threadstest.c
index 969ef1680d..0709c4f1a0 100644
--- a/test/threadstest.c
+++ b/test/threadstest.c
@@ -128,7 +128,7 @@ static void rwwriter_fn(int id, int *iterations)
new = OPENSSL_zalloc(sizeof(int));
OPENSSL_assert(new != NULL);
if (contention == 0)
- OSSL_sleep(1000);
+ OSSL_sleep(1);
if (!CRYPTO_THREAD_write_lock(rwtorturelock))
abort();
if (rwwriter_ptr != NULL) {
@@ -335,7 +335,7 @@ static void writer_fn(int id, int *iterations)
}
if (contention == 0)
- OSSL_sleep(1000);
+ OSSL_sleep(1);
ossl_rcu_write_lock(rcu_lock);
old = ossl_rcu_deref(&writer_ptr);
TSAN_ACQUIRE(&writer_ptr);