GNOME Bugzilla – Bug 674213
tests: Fix race conditions in mainloop/invoke test
Last modified: 2012-04-16 18:17:10 UTC
1) The test was using GCond incorrectly (it always needs a state variable) 2) The state assertion was racing with the thread; just swap the lines for the assert with the invoke. All we're really trying to test here is that the invoke runs by the time the thread is gone.
Created attachment 212163 [details] [review] tests: Fix race conditions in mainloop/invoke test
Comment on attachment 212163 [details] [review] tests: Fix race conditions in mainloop/invoke test >2) The state assertion was racing with the thread; just swap > the lines for the assert with the invoke. All we're really > trying to test here is that the invoke runs by the time the > thread is gone. I think the goal was "make sure that g_main_context_invoke() didn't invoke func() directly", but func() already has an assertion that it's being run in the expected thread, so we're ok. There's already an assertion that count==2 before we create the context though, and no reason to imagine it would have changed in the interim, so you could just remove that check entirely. >+static gboolean cond_b; a real name would be nice ("thread_ready"?) ok to commit however
Fixed for both comments. Attachment 212163 [details] pushed as 3ac2930 - tests: Fix race conditions in mainloop/invoke test