[Threading] Create new threading library and use it.

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
This commit is contained in:
Alastair Houghton
2022-04-15 13:50:33 +01:00
parent 66b9d21000
commit f5bdb858e0
98 changed files with 2286 additions and 1410 deletions

View File

@@ -0,0 +1,37 @@
//===--- Impl.h - Threading abstraction implementation -------- -*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2022 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
//
//===----------------------------------------------------------------------===//
//
// Includes the relevant implementation file based on the selected threading
// package.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_THREADING_IMPL_H
#define SWIFT_THREADING_IMPL_H
#if SWIFT_THREADING_NONE
#include "Impl/Nothreads.h"
#elif SWIFT_THREADING_DARWIN
#include "Impl/Darwin.h"
#elif SWIFT_THREADING_LINUX
#include "Impl/Linux.h"
#elif SWIFT_THREADING_PTHREADS
#include "Impl/Pthreads.h"
#elif SWIFT_THREADING_C11
#include "Impl/C11.h"
#elif SWIFT_THREADING_WIN32
#include "Impl/Win32.h"
#else
#error You need to implement Threading/Impl.h for your threading package.
#endif
#endif // SWIFT_THREADING_IMPL_H