mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
* Rework YieldingContinuation to service values in a buffered fashion * Fix word size calculation for locks * Handle terminal states and finished/failed storage * Wrap yielding continuation into a more featureful type for better ergonomics * Hope springs eternal, maybe windows works with this? * Prevent value overflows at .max limits * Add a cancellation handler * Fix series tests missing continuation parameters * Fix series tests for mutable itertaors * Rename to a more general name for Series's inner continuation type * Whitespace fixes and add more commentary about public functions on Series * Restore YieldingContinuation for now with deprecations to favor Series * Ensure onCancel is invoked in deinit phases, and eliminate a potential for double cancellation * Make sure ThrowingSeries has the same nonmutating setter for onCancel as Series * Add a swath of more unit tests that exersize cancellation behavior as well as throwing behaviors * Remove work-around for async testing * Fixup do/catch range to properly handle ThrowingSeries test * Address naming consistency of resume result function * Adopt the async main test setup * More migration of tests to new async mechanisms * Handle the double finish/throw case * Ensure the dependency on Dispatch is built for the series tests (due to semaphore usage) * Add import-libdispatch to run command for Series tests * Use non-combine based timeout intervals (portable to linux) for dispatch semaphore * Rename Series -> AsyncStream and resume functions to just yield, and correct a missing default Element.self value * Fix missing naming change issue for yielding an error on AsyncThrowingStream * Remove argument label of buffering from tests * Extract buffer and throwing variants into their own file * Slightly refactor for only needing to store the producer instead of producer and cancel * Rename onCancel to onTermination * Convert handler access into a function pair * Add finished states to the termination handler event pipeline and a disambiguation enum to identify finish versus cancel * Ensure all termination happens before event propigation (and outside of the locks) and warn against requirements for locking on terminate and enqueue * Modified to use Deque to back the storage and move the storage to inner types; overall perf went from 200kE/sec to over 1ME/sec * Update stdlib/public/Concurrency/AsyncStream.swift Co-authored-by: Doug Gregor <dgregor@apple.com> * Update stdlib/public/Concurrency/AsyncThrowingStream.swift Co-authored-by: Doug Gregor <dgregor@apple.com> * Update stdlib/public/Concurrency/AsyncStream.swift Co-authored-by: Joseph Heck <heckj@mac.com> * Update stdlib/public/Concurrency/AsyncThrowingStream.swift Co-authored-by: Joseph Heck <heckj@mac.com> * Update stdlib/public/Concurrency/AsyncThrowingStream.swift Co-authored-by: Joseph Heck <heckj@mac.com> * Update stdlib/public/Concurrency/AsyncThrowingStream.swift Co-authored-by: Joseph Heck <heckj@mac.com> * Update stdlib/public/Concurrency/AsyncStream.swift Co-authored-by: Joseph Heck <heckj@mac.com> * Update stdlib/public/Concurrency/AsyncThrowingStream.swift Co-authored-by: Joseph Heck <heckj@mac.com> * Remove local cruft for overlay disabling * Remove local cruft for Dispatch overlay work * Remove potential ABI impact for adding Deque Co-authored-by: Doug Gregor <dgregor@apple.com> Co-authored-by: Joseph Heck <heckj@mac.com>
102 lines
2.8 KiB
CMake
102 lines
2.8 KiB
CMake
#===--- CMakeLists.txt - Concurrency support library ---------------------===#
|
|
#
|
|
# This source file is part of the Swift.org open source project
|
|
#
|
|
# Copyright (c) 2019 - 2020 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
|
|
#
|
|
#===----------------------------------------------------------------------===#
|
|
|
|
set(swift_concurrency_objc_sources
|
|
SwiftNativeNSObject.mm)
|
|
|
|
set(LLVM_OPTIONAL_SOURCES
|
|
${swift_concurrency_objc_sources})
|
|
|
|
set(swift_concurrency_link_libraries
|
|
swiftCore)
|
|
|
|
if(SWIFT_CONCURRENCY_USES_DISPATCH)
|
|
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
|
include_directories(AFTER
|
|
${SWIFT_PATH_TO_LIBDISPATCH_SOURCE})
|
|
|
|
# FIXME: we can't rely on libdispatch having been built for the
|
|
# target at this point in the process. Currently, we're relying
|
|
# on soft-linking.
|
|
list(APPEND swift_concurrency_link_libraries
|
|
dispatch)
|
|
endif()
|
|
endif()
|
|
|
|
|
|
add_swift_target_library(swift_Concurrency ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
|
|
../CompatibilityOverride/CompatibilityOverride.cpp
|
|
Actor.cpp
|
|
Actor.swift
|
|
AsyncLet.cpp
|
|
AsyncLet.swift
|
|
CheckedContinuation.swift
|
|
GlobalExecutor.cpp
|
|
Errors.swift
|
|
Error.cpp
|
|
Executor.swift
|
|
AsyncCompactMapSequence.swift
|
|
AsyncDropFirstSequence.swift
|
|
AsyncDropWhileSequence.swift
|
|
AsyncFilterSequence.swift
|
|
AsyncFlatMapSequence.swift
|
|
AsyncIteratorProtocol.swift
|
|
AsyncMapSequence.swift
|
|
AsyncPrefixSequence.swift
|
|
AsyncPrefixWhileSequence.swift
|
|
AsyncSequence.swift
|
|
AsyncThrowingCompactMapSequence.swift
|
|
AsyncThrowingDropWhileSequence.swift
|
|
AsyncThrowingFilterSequence.swift
|
|
AsyncThrowingFlatMapSequence.swift
|
|
AsyncThrowingMapSequence.swift
|
|
AsyncThrowingPrefixWhileSequence.swift
|
|
PartialAsyncTask.swift
|
|
Task.cpp
|
|
Task.swift
|
|
TaskCancellation.swift
|
|
TaskAlloc.cpp
|
|
TaskStatus.cpp
|
|
TaskGroup.cpp
|
|
TaskGroup.swift
|
|
TaskLocal.cpp
|
|
TaskLocal.swift
|
|
ThreadSanitizer.cpp
|
|
Mutex.cpp
|
|
AsyncStreamBuffer.swift
|
|
AsyncStream.swift
|
|
AsyncThrowingStream.swift
|
|
AsyncStream.cpp
|
|
Deque.swift
|
|
${swift_concurrency_objc_sources}
|
|
|
|
SWIFT_MODULE_DEPENDS_LINUX Glibc
|
|
SWIFT_MODULE_DEPENDS_FREEBSD Glibc
|
|
SWIFT_MODULE_DEPENDS_OPENBSD Glibc
|
|
SWIFT_MODULE_DEPENDS_CYGWIN Glibc
|
|
SWIFT_MODULE_DEPENDS_HAIKU Glibc
|
|
SWIFT_MODULE_DEPENDS_WINDOWS CRT
|
|
|
|
LINK_LIBRARIES ${swift_concurrency_link_libraries}
|
|
|
|
C_COMPILE_FLAGS
|
|
-Dswift_Concurrency_EXPORTS
|
|
SWIFT_COMPILE_FLAGS
|
|
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
|
|
-parse-stdlib
|
|
-Xfrontend -enable-experimental-concurrency
|
|
-Xfrontend -define-availability
|
|
-Xfrontend \"SwiftStdlib 5.5:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999\"
|
|
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
|
|
INSTALL_IN_COMPONENT stdlib
|
|
)
|