Fix race condition when using --threads with linker plugins.