kernel32/tests: Fix race condition in the thread test.