Skip to content

Commit 35065bb

Browse files
author
Julian Lettner
committed
Remove Windows code
Thread Sanitizer is not supported on Windows.
1 parent 20df19f commit 35065bb

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

stdlib/public/Concurrency/ThreadSanitizer.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,16 @@
1616

1717
#include "TaskPrivate.h"
1818

19+
// Thread Sanitizer is not supported on Windows.
1920
#if defined(_WIN32)
20-
#define NOMINMAX
21-
#include <windows.h>
21+
void swift::_swift_tsan_acquire(void *addr) {}
22+
void swift::_swift_tsan_release(void *addr) {}
2223
#else
2324
#include <dlfcn.h>
24-
#endif
2525

2626
namespace {
2727
using TSanFunc = void(void *);
2828
TSanFunc *tsan_acquire, *tsan_release;
29-
30-
TSanFunc *loadSymbol(const char *name) {
31-
#if defined(_WIN32)
32-
return (TSanFunc *)GetProcAddress(GetModuleHandle(NULL), name);
33-
#else
34-
return (TSanFunc *)dlsym(RTLD_DEFAULT, name);
35-
#endif
36-
}
3729
} // anonymous namespace
3830

3931
void swift::_swift_tsan_acquire(void *addr) {
@@ -50,6 +42,7 @@ void swift::_swift_tsan_release(void *addr) {
5042

5143
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(c)
5244
void __tsan_on_initialize() {
53-
tsan_acquire = loadSymbol("__tsan_acquire");
54-
tsan_release = loadSymbol("__tsan_release");
45+
tsan_acquire = (TSanFunc *)dlsym(RTLD_DEFAULT, "__tsan_acquire");
46+
tsan_release = (TSanFunc *)dlsym(RTLD_DEFAULT, "__tsan_release");
5547
}
48+
#endif

0 commit comments

Comments
 (0)