From 243610bc10bb3a31c0f3ba08fc6b46a4f897f7d9 Mon Sep 17 00:00:00 2001 From: Fabrice Bellet Date: Thu, 16 Jun 2016 20:51:19 +0200 Subject: tests: fix io-stream when built with optimizations In construct like "while (foo);" when foo is modified outside of the current thread, the variable should be declared volatile to suggest the compiler to read its value without making code optimization. --- tests/test-io-stream-common.c | 2 +- tests/test-io-stream-common.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-io-stream-common.c b/tests/test-io-stream-common.c index efa6160..b34748d 100644 --- a/tests/test-io-stream-common.c +++ b/tests/test-io-stream-common.c @@ -500,7 +500,7 @@ run_io_stream_test (guint deadlock_timeout, gboolean reliable, * This must only be called from the read thread implementation. */ void check_for_termination (TestIOStreamThreadData *data, gsize *recv_count, - gsize *other_recv_count, gsize *send_count, gsize expected_recv_count) + gsize *other_recv_count, volatile gsize *send_count, gsize expected_recv_count) { guint stream_id; gpointer tmp; diff --git a/tests/test-io-stream-common.h b/tests/test-io-stream-common.h index 8f7bac1..1e37954 100644 --- a/tests/test-io-stream-common.h +++ b/tests/test-io-stream-common.h @@ -102,6 +102,6 @@ void run_io_stream_test (guint deadlock_timeout, gboolean reliable, gpointer l_user_data, GDestroyNotify l_user_data_free, gpointer r_user_data, GDestroyNotify r_user_data_free); void check_for_termination (TestIOStreamThreadData *data, gsize *recv_count, - gsize *other_recv_count, gsize *send_count, gsize expected_recv_count); + gsize *other_recv_count, volatile gsize *send_count, gsize expected_recv_count); void stop_main_loop (GMainLoop *loop); -- cgit v1.2.1