gio/tests/task: fix a race condition in test_run_in_thread()
authorDan Winship <danw@gnome.org>
Thu, 15 Aug 2013 15:30:59 +0000 (11:30 -0400)
committerDan Winship <danw@gnome.org>
Thu, 15 Aug 2013 16:43:57 +0000 (12:43 -0400)
commita93d373812e37dbac3b749457cedf290227ef441
treef40d347b2fb56df30ce87ee91d63994fc0841ee2
parent4b334ef8f1393c997a2d83de4ffe0976dff238c3
gio/tests/task: fix a race condition in test_run_in_thread()

When running a task in a thread, GTask may still be internally holding
a ref on the task in that thread even after the callback is called in
the original thread (depending on thread scheduling). Fix the test to
handle that by using a weak notify that signals a GCond, and wait for
that GCond from the main thread. (And add a corresponding check to
test_return_on_cancel().)

https://bugzilla.gnome.org/show_bug.cgi?id=705152
gio/tests/task.c