[Concurrency][Threading] Remove use of platform thread functions.

The concurrency library can use the new threading library functions,
which avoids the problem of including <windows.h>.

rdar://90776105
This commit is contained in:
Alastair Houghton
2022-04-27 20:26:27 +01:00
parent 79e2d0d37d
commit c034d6c3da
6 changed files with 71 additions and 60 deletions

View File

@@ -25,11 +25,15 @@ namespace swift {
/// Identifies a thread
class Thread {
public:
using Id = threading_impl::thread_id;
private:
threading_impl::thread_id id_;
Id id_;
public:
Thread() {}
explicit Thread(Id platformId) : id_(platformId) {}
Thread(const Thread& other) : id_(other.id_) {}
Thread(Thread&& other) : id_(std::move(other.id_)) {}
@@ -43,6 +47,9 @@ public:
return *this;
}
/// Returns the platform specific thread ID
Id platformThreadId() const { return id_; }
/// Returns the currently executing thread
static Thread current() {
return Thread(threading_impl::thread_get_current());