diff options
author | Fabrice Bellet <fabrice@bellet.info> | 2016-06-16 20:51:19 +0200 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2016-06-20 18:24:48 -0400 |
commit | 243610bc10bb3a31c0f3ba08fc6b46a4f897f7d9 (patch) | |
tree | 03aac016fb22481e542049bb24372a87665048e1 | |
parent | 7ea00f610185ebb55f49fe2b32677a0d279f2530 (diff) | |
download | libnice-243610bc10bb3a31c0f3ba08fc6b46a4f897f7d9.tar.gz |
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.
-rw-r--r-- | tests/test-io-stream-common.c | 2 | ||||
-rw-r--r-- | 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); |