File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 27
27
28
28
#include " ../runtime/StackAllocator.h"
29
29
30
+ #if HAVE_PTHREAD_H
31
+ #include < pthread.h>
32
+ #endif
33
+ #if defined(_WIN32)
34
+ #define WIN32_LEAN_AND_MEAN
35
+ #define VC_EXTRA_LEAN
36
+ #define NOMINMAX
37
+ #include < Windows.h>
38
+ #endif
39
+
30
40
namespace swift {
31
41
32
42
// Set to 1 to enable helpful debug spew to stderr
@@ -41,6 +51,20 @@ namespace swift {
41
51
#define SWIFT_TASK_DEBUG_LOG (fmt, ...) (void )0
42
52
#endif
43
53
54
+ #if defined(_WIN32)
55
+ using ThreadID = decltype (GetCurrentThreadId());
56
+ #else
57
+ using ThreadID = decltype (pthread_self());
58
+ #endif
59
+
60
+ inline ThreadID _swift_get_thread_id () {
61
+ #if defined(_WIN32)
62
+ return GetCurrentThreadId ();
63
+ #else
64
+ return pthread_self ();
65
+ #endif
66
+ }
67
+
44
68
class AsyncTask ;
45
69
class TaskGroup ;
46
70
You can’t perform that action at this time.
0 commit comments