You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a condition variable to control busy threads in dispatch_apply test
The dispatch_apply test sometimes fails in multicore machines. The
failed function is test_apply_contended which tests if dispatch_apply
can make progress and finish with N concurrent busy threads running,
where N is the number of CPUs. According to the testing log, it fails
because some busy threads already finish before dispatch_apply() is
invoked.
This happens because the test uses the ITERS_PER_SECOND variable to
control the number of iteration of the loop in the busy thread and
optimistically __hope__ the execution time is long enough to complete
the test. But sometimes this hope fails when the testing machine has
greater computing power and more CPU cores.
Instead of using ITERS_PER_SECOND, which makes an assumption about the
computing power of the test machine, a condition variable is used to
control execution of busy threads. It makes sure the busy thread can
only finish after dispatch_apply completes.
0 commit comments