This library is pulled into the standard library. Add autolinking
directives to enable the use of the library with static linking without
specifying the system dependencies. This is required to enable the user
to use `-static-stdlib` without having to specify all dependencies.
The implementation mistakenly locked and unlocked the mutex in
`helper.once_wait()`, which is only ever called from inside a region
where the mutex is already locked.
rdar://119739594
We need to pick up the `_swift_tsan_xxx` symbols from libswiftCore in
most cases, but sometimes we're statically linked and in that case we
want to use a local copy.
rdar://1106655213
On Darwin, `RTLD_NEXT` doesn't do what we need it to here, with the
result that if `libswiftCore`'s TSan initializer gets found first,
then `libswift_Concurrency` won't have its initializer called at all,
in spite of us using `RTLD_NEXT` to find the next definition.
Fix this by centralising the initializer in `libswiftCore` instead.
rdar://110665213
* Use the longer name ThreadSanitizer rather than TSan for the new files.
* Don't implement `tsan::consume` at all for now.
* Do the `tsan::release` for `ulock_unlock()` at the head of the function,
not at the tail.
* Add a comment to test/Sanitizers/tsan/once.swift to explain the test a
little more clearly.
rdar://110665213
Move the TSan functionality from Concurrency into Threading. Use it
in the Linux `ulock` implementation so that TSan knows about `ulock`
and will tolerate the newer `swift_once` implementation that uses it.
rdar://110665213
This repairs the Windows x86 SDK build after #59287. Use `intptr_t`
rather than the explicitly sized integer as this is always guaranteed to
be the size of the pointer width (irrespective of LP64/LP32 or
LLP64/LLP32). Since this impacts only the once predicate, this
shouldn't impact any assumptions around structure sizes.
The threading implementations need to include Impl.h, not just their
specific variant, to pick up the `stack_bounds` type.
Also fix a newly exposed problem with Atomic.h.
rdar://90776105
Removing thread_get_main() means we don't need a static initializer on
Darwin, which means we can delete Darwin.cpp as well. We can also delete
Nothreads.cpp while we're about it, because there's nothing in that file.
rdar://90776105
We shouldn't include <windows.h> implicitly from .cpp files, but should
do it directly so that we know it's there.
Also, if we're including <windows.h>, do it at the top of the file.
rdar://90776105
Moved all the threading code to one place. Added explicit support for
Darwin, Linux, Pthreads, C11 threads and Win32 threads, including new
implementations of Once for Linux, Pthreads, C11 and Win32.
rdar://90776105
The threading implementations need to include Impl.h, not just their
specific variant, to pick up the `stack_bounds` type.
Also fix a newly exposed problem with Atomic.h.
rdar://90776105
Removing thread_get_main() means we don't need a static initializer on
Darwin, which means we can delete Darwin.cpp as well. We can also delete
Nothreads.cpp while we're about it, because there's nothing in that file.
rdar://90776105
We shouldn't include <windows.h> implicitly from .cpp files, but should
do it directly so that we know it's there.
Also, if we're including <windows.h>, do it at the top of the file.
rdar://90776105
Moved all the threading code to one place. Added explicit support for
Darwin, Linux, Pthreads, C11 threads and Win32 threads, including new
implementations of Once for Linux, Pthreads, C11 and Win32.
rdar://90776105