File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 16
16
17
17
#include " TaskPrivate.h"
18
18
19
+ #if defined(_WIN32)
20
+ #define NOMINMAX
21
+ #include < windows.h>
22
+ #else
19
23
#include < dlfcn.h>
24
+ #endif
20
25
21
26
using TSanFunc = void (void *);
22
27
28
+ namespace {
29
+ static TSanFunc *loadSymbol (const char *name) {
30
+ #if defined(_WIN32)
31
+ return (TSanFunc *)GetProcAddress (GetModuleHandle (NULL ), name);
32
+ #else
33
+ return (TSanFunc *)dlsym (RTLD_DEFAULT, name);
34
+ #endif
35
+ }
36
+ }
37
+
23
38
void swift::_swift_tsan_acquire (void *addr) {
24
- static auto ptr = (TSanFunc *) dlsym (RTLD_DEFAULT, " __tsan_acquire" );
39
+ static auto ptr = loadSymbol ( " __tsan_acquire" );
25
40
if (ptr) {
26
41
ptr (addr);
27
42
}
28
43
}
29
44
30
45
void swift::_swift_tsan_release (void *addr) {
31
- static auto ptr = (TSanFunc *) dlsym (RTLD_DEFAULT, " __tsan_release" );
46
+ static auto ptr = loadSymbol ( " __tsan_release" );
32
47
if (ptr) {
33
48
ptr (addr);
34
49
}
You can’t perform that action at this time.
0 commit comments