tests: Rewrite thread-pool test for freeing queued items
The previous test was racy: it assumed that not all queued thread pool
jobs would start to be executed before g_thread_pool_free()
was
called, whereas actually on some systems (particularly BSD ones), they
would all start (or even finish) being executed, and hence the free
function might never be called.
Rewrite the test to: • Synchronise the test function and worker thread functions more closely. • Not bother about ordering the shared and exclusive variants of the test differently. That seems to be a hangover from another test above. • Limit the number of worker threads to 1, rather than 2, since this makes the test easier to control.
This has been tested with --repeat 10000
on Linux, and it succeeds all
of those runs whereas previously it failed quite reliably.
Signed-off-by: Philip Withnall pwithnall@endlessos.org
Fixes: #2456 (closed)
Closes #2456 (closed)