Commit Graph

8 Commits

Author SHA1 Message Date
Yuta Saito
00705b4b2a [Concurrency] Fix calling convention mismatch in AsyncStream
Functions defined in AsyncStream.cpp are called from Swift with swiftcc
but are defined with the C calling convention.
2023-06-11 12:26:52 +00:00
Alastair Houghton
0e9318cec5 [Threading] Put everything through git clang-format.
Just formatting changes.

rdar://90776105
2022-06-07 07:39:53 +01:00
Alastair Houghton
f5bdb858e0 [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
2022-06-07 07:39:51 +01:00
Alex Hoppen
4aa2bbbf06 Revert "Merge pull request #42447 from al45tair/eng/PR-90776105"
This reverts commit 8bcb71140f, reversing
changes made to c4dd271d36.
2022-06-02 18:03:23 +02:00
Alastair Houghton
b5bd267ff1 [Threading] Put everything through git clang-format.
Just formatting changes.

rdar://90776105
2022-05-24 14:57:41 +01:00
Alastair Houghton
63a09007a1 [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
2022-05-24 14:57:39 +01:00
Saleem Abdulrasool
910fbee14e gardening: make c++98-compat-extra-semi an error
This cleans up 90 instances of this warning and reduces the build spew
when building on Linux.  This helps identify actual issues when
building which can get lost in the stream of warning messages.  It also
helps restore the ability to build the compiler with gcc.
2021-11-27 11:40:17 -08:00
Philippe Hausler
4886bd56e4 [Concurrency] AsyncStream and AsyncThrowingStream
* 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>
2021-05-11 21:41:33 -07:00