Eliminate race condition in multi-threading backend.