[lld] Move Threads to Common

Summary:
This will allow using the functionality from other linkers. It is also
a prerequisite for sharing the error logging code.

Reviewers: ruiu

Reviewed By: ruiu

Subscribers: emaste, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D38822

llvm-svn: 315725
diff --git a/lld/ELF/Filesystem.cpp b/lld/ELF/Filesystem.cpp
index 03dd2e8..35310b0 100644
--- a/lld/ELF/Filesystem.cpp
+++ b/lld/ELF/Filesystem.cpp
@@ -13,7 +13,7 @@
 
 #include "Filesystem.h"
 #include "Config.h"
-#include "Threads.h"
+#include "lld/Common/Threads.h"
 #include "llvm/Support/FileOutputBuffer.h"
 #include "llvm/Support/FileSystem.h"
 
@@ -38,7 +38,7 @@
 // This function spawns a background thread to call unlink.
 // The calling thread returns almost immediately.
 void elf::unlinkAsync(StringRef Path) {
-  if (!Config->Threads || !sys::fs::exists(Config->OutputFile) ||
+  if (!ThreadsEnabled || !sys::fs::exists(Config->OutputFile) ||
       !sys::fs::is_regular_file(Config->OutputFile))
     return;