summaryrefslogtreecommitdiff
path: root/tests/test-qht.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-qht.c')
-rw-r--r--tests/test-qht.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/test-qht.c b/tests/test-qht.c
index 46a64b6731..9b7423abb6 100644
--- a/tests/test-qht.c
+++ b/tests/test-qht.c
@@ -6,6 +6,7 @@
*/
#include "qemu/osdep.h"
#include "qemu/qht.h"
+#include "qemu/rcu.h"
#define N 5000
@@ -51,6 +52,7 @@ static void check(int a, int b, bool expected)
struct qht_stats stats;
int i;
+ rcu_read_lock();
for (i = a; i < b; i++) {
void *p;
uint32_t hash;
@@ -61,6 +63,8 @@ static void check(int a, int b, bool expected)
p = qht_lookup(&ht, is_equal, &val, hash);
g_assert_true(!!p == expected);
}
+ rcu_read_unlock();
+
qht_statistics_init(&ht, &stats);
if (stats.used_head_buckets) {
g_assert_cmpfloat(qdist_avg(&stats.chain), >=, 1.0);