-
Notifications
You must be signed in to change notification settings - Fork 146
Expand file tree
/
Copy pathFallbackEventHandler.cpp
More file actions
27 lines (22 loc) · 992 Bytes
/
FallbackEventHandler.cpp
File metadata and controls
27 lines (22 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2025–2026 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//
#if !defined(SWT_NO_INTEROP)
#include "../_TestingInternals/include/FallbackEventHandler.h"
#include <atomic>
/// Storage for the fallback event handler.
static std::atomic<SWTFallbackEventHandler> fallbackEventHandler { nullptr };
bool _swift_testing_installFallbackEventHandler(SWTFallbackEventHandler handler) {
SWTFallbackEventHandler nullptrValue = nullptr;
return fallbackEventHandler.compare_exchange_strong(nullptrValue, handler, std::memory_order_seq_cst, std::memory_order_relaxed);
}
SWTFallbackEventHandler _swift_testing_getFallbackEventHandler(void) {
return fallbackEventHandler.load(std::memory_order_seq_cst);
}
#endif