[Build][Runtime] Replace SWIFT_STDLIB_SINGLE_THREADED_RUNTIME.

SWIFT_STDLIB_SINGLE_THREADED_RUNTIME is too much of a blunt instrument here.
It covers both the Concurrency runtime and the rest of the runtime, but we'd
like to be able to have e.g. a single-threaded Concurrency runtime while
the rest of the runtime is still thread safe (for instance).

So: rename it to SWIFT_STDLIB_SINGLE_THREADED_CONCURRENCY and make it just
control the Concurrency runtime, then add a SWIFT_STDLIB_THREADING_PACKAGE
setting at the CMake/build-script level, which defines
SWIFT_STDLIB_THREADING_xxx where xxx depends on the chosen threading package.

This is especially useful on systems where there may be a choice of threading
package that you could use.

rdar://90776105
This commit is contained in:
Alastair Houghton
2022-03-25 16:10:39 +00:00
parent 3c0b1ab03f
commit dadcb04ae2
44 changed files with 547 additions and 204 deletions

View File

@@ -17,12 +17,12 @@
//
//===----------------------------------------------------------------------===//
#if SWIFT_STDLIB_THREADING_PTHREADS || SWIFT_STDLIB_THREADING_DARWIN
#if __has_include(<unistd.h>)
#include <unistd.h>
#endif
#if defined(_POSIX_THREADS) && !defined(SWIFT_STDLIB_SINGLE_THREADED_RUNTIME)
// Notes: swift::fatalError is not shared between libswiftCore and libswift_Concurrency
// and libswift_Concurrency uses swift_Concurrency_fatalError instead.
#ifndef SWIFT_FATAL_ERROR
@@ -139,4 +139,5 @@ void ReadWriteLockPlatformHelper::readUnlock(pthread_rwlock_t &rwlock) {
void ReadWriteLockPlatformHelper::writeUnlock(pthread_rwlock_t &rwlock) {
reportError(pthread_rwlock_unlock(&rwlock));
}
#endif
#endif // SWIFT_STDLIB_THREADING_PTHREADS