Sendable violations inside `@preconcurrency @Sendable` closures should be
suppressed in minimal checking, and diagnosed as warnings under complete
checking, including the Swift 6 language mode.
As of the changes in https://github.com/swiftlang/swift/pull/41713 to
enable Sendability for AsyncStream, it has been possible to create
multiple stream consumers operating concurrently. This change fixes
behavior in the case that the underlying stream is terminated while
multiple pending continuations are outstanding. Previously such
consumers would have been leaked (never resumed). Now, they are notified
of the stream's termination and resumed appropriately.
Resolves#66541 & #71412
These were previously disabled due to the UB that caused the tests to
fail. Now that this has been fixed, restore these tests to running
state in line with the other targets.
Rather than blanket-disabling concurrency tests when we aren't using a
just-built concurrency library, enable them whenever we have a
suitable concurrency runtime, either just-built, in the OS, or via the
back-deployment libraries.
* 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>