Fix global variable name hidden by local variables in glib/tests/cond.c

This commit is contained in:
Loic Le Page 2022-01-19 17:45:38 +01:00 committed by Philip Withnall
parent f8302d29f1
commit 7c138574bd

View File

@ -239,7 +239,7 @@ test_wait_until (void)
{ {
gint64 until; gint64 until;
GMutex lock; GMutex lock;
GCond cond; GCond local_cond;
/* This test will make sure we don't wait too much or too little. /* This test will make sure we don't wait too much or too little.
* *
@ -249,13 +249,13 @@ test_wait_until (void)
* should not wake up until the specified time has passed. * should not wake up until the specified time has passed.
*/ */
g_mutex_init (&lock); g_mutex_init (&lock);
g_cond_init (&cond); g_cond_init (&local_cond);
until = g_get_monotonic_time () + G_TIME_SPAN_SECOND; until = g_get_monotonic_time () + G_TIME_SPAN_SECOND;
/* Could still have spurious wakeups, so we must loop... */ /* Could still have spurious wakeups, so we must loop... */
g_mutex_lock (&lock); g_mutex_lock (&lock);
while (g_cond_wait_until (&cond, &lock, until)) while (g_cond_wait_until (&local_cond, &lock, until))
; ;
g_mutex_unlock (&lock); g_mutex_unlock (&lock);
@ -265,11 +265,11 @@ test_wait_until (void)
/* Make sure it returns FALSE on timeout */ /* Make sure it returns FALSE on timeout */
until = g_get_monotonic_time () + G_TIME_SPAN_SECOND / 50; until = g_get_monotonic_time () + G_TIME_SPAN_SECOND / 50;
g_mutex_lock (&lock); g_mutex_lock (&lock);
g_assert (g_cond_wait_until (&cond, &lock, until) == FALSE); g_assert (g_cond_wait_until (&local_cond, &lock, until) == FALSE);
g_mutex_unlock (&lock); g_mutex_unlock (&lock);
g_mutex_clear (&lock); g_mutex_clear (&lock);
g_cond_clear (&cond); g_cond_clear (&local_cond);
} }
#ifdef __linux__ #ifdef __linux__