Skip to content

Commit 81afe50

Browse files
authored
Merge pull request #39756 from DougGregor/back-deployed-concurrency-disable-exclusivity
2 parents 1a5bc04 + 18323dd commit 81afe50

File tree

4 files changed

+11
-26
lines changed

4 files changed

+11
-26
lines changed

stdlib/public/BackDeployConcurrency/Exclusivity.cpp

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,16 @@
1414
//
1515
//===----------------------------------------------------------------------===//
1616
#include <cinttypes>
17-
18-
#include "swift/Basic/Lazy.h"
1917
#include "swift/Runtime/Exclusivity.h"
20-
#include "swift/Runtime/ThreadLocalStorage.h"
21-
#include "../runtime/ExclusivityPrivate.h"
22-
#include "../runtime/SwiftTLSContext.h"
2318

2419
using namespace swift;
25-
using namespace swift::runtime;
2620

27-
SwiftTLSContext &SwiftTLSContext::get() {
28-
SwiftTLSContext *ctx = static_cast<SwiftTLSContext *>(
29-
SWIFT_THREAD_GETSPECIFIC(SWIFT_RUNTIME_TLS_KEY));
30-
if (ctx)
31-
return *ctx;
21+
void swift::swift_task_enterThreadLocalContextBackDeploy(char *state) { }
3222

33-
static OnceToken_t setupToken;
34-
SWIFT_ONCE_F(
35-
setupToken,
36-
[](void *) {
37-
pthread_key_init_np(SWIFT_RUNTIME_TLS_KEY, [](void *pointer) {
38-
delete static_cast<SwiftTLSContext *>(pointer);
39-
});
40-
},
41-
nullptr);
23+
void swift::swift_task_exitThreadLocalContextBackDeploy(char *state) { }
4224

43-
ctx = new SwiftTLSContext();
44-
SWIFT_THREAD_SETSPECIFIC(SWIFT_RUNTIME_TLS_KEY, ctx);
45-
return *ctx;
25+
// Forcibly disable exclusivity checking, because the back-deployed concurrency
26+
// library cannot communicate with older Swift runtimes effectively.
27+
__attribute__((constructor)) static void disableExclusivityChecking() {
28+
_swift_disableExclusivityChecking = true;
4629
}
47-
48-
// Bring in the concurrency-specific exclusivity code.
49-
#include "../runtime/ConcurrencyExclusivity.inc"

test/Concurrency/Runtime/exclusivity.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// REQUIRES: concurrency_runtime
77
// UNSUPPORTED: back_deployment_runtime
88
// UNSUPPORTED: OS=wasi
9+
// UNSUPPORTED: use_os_stdlib
910

1011
// This test makes sure that:
1112
//

test/Concurrency/Runtime/exclusivity_custom_executors.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
// Disabled until test hang can be looked at.
1414
// UNSUPPORTED: OS=windows-msvc
1515

16+
// UNSUPPORTED: use_os_stdlib
17+
1618
// This test makes sure that we properly save/restore access when we
1719
// synchronously launch a task from a serial executor. The access from the task
1820
// should be merged into the already created access set while it runs and then

test/Interpreter/enforce_exclusive_access.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
// REQUIRES: executable_test
77
// UNSUPPORTED: single_threaded_runtime
88

9+
// UNSUPPORTED: use_os_stdlib
10+
911
// Tests for traps at run time when enforcing exclusive access.
1012

1113
import StdlibUnittest

0 commit comments

Comments
 (0)