mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user