Files
swift-mirror/stdlib/public/BackDeployConcurrency/Exclusivity.cpp
Doug Gregor 6fd85ac7a3 Clone exclusivity save/restore for tasks into back-deployment library
The code that saves/restores the exclusivity checks for tasks was
newly introduced into the runtime. Clone that code into the back-
deployed version of the runtime.
2021-08-30 16:39:33 -07:00

36 lines
1.2 KiB
C++

//===--- Exclusivity.cpp - Exclusivity tracking ---------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 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 the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This implements the runtime support for dynamically tracking exclusivity.
//
//===----------------------------------------------------------------------===//
#include <cinttypes>
#include "swift/Runtime/Exclusivity.h"
#include "../runtime/ExclusivityPrivate.h"
#include "../runtime/SwiftTLSContext.h"
using namespace swift;
using namespace swift::runtime;
// Thread-local storage used by the back-deployed concurrency library.
namespace {
static thread_local SwiftTLSContext TLSContext;
} // anonymous namespace
SwiftTLSContext &SwiftTLSContext::get() { return TLSContext; }
// Bring in the concurrency-specific exclusivity code.
#include "../runtime/ConcurrencyExclusivity.inc"