Commit Graph

31 Commits

Author SHA1 Message Date
Alastair Houghton
47fa71787f Revert "Merge pull request #80224 from glessard/revert-79789-custom-executors"
This reverts commit 06f6358067, reversing
changes made to 033f6679e8.
2025-03-28 10:15:07 +00:00
Alastair Houghton
8b15b05c63 Revert "[Concurrency] Provide a Swift interface for custom main and global executors." 2025-03-22 02:38:11 -07:00
Alastair Houghton
090c375b7b [Concurrency] Swift interface for custom main and global executors.
Reorganise the Concurrency code so that it's possible to completely
implement executors (both main and global) in Swift.

Provide API to choose the desired executors for your application.

Also make `Task.Sleep` wait using the current executor, not the global
executor, and expose APIs on `Clock` to allow for conversion between
time bases.

rdar://141348916
2025-03-13 13:34:41 +00:00
Allan Shortlidge
c02fc4724d Tests: Remove -disable-availability-checking from many Concurrency tests.
Instead, use the `%target-swift-5.1-abi-triple` substitution to compile the tests
for deployment to the minimum OS versions required for use of _Concurrency APIs.
2024-10-18 16:21:51 -07:00
Alastair Houghton
0cf687aa2b [Build][Runtime] Replace SWIFT_STDLIB_SINGLE_THREADED_RUNTIME.
SWIFT_STDLIB_SINGLE_THREADED_RUNTIME is too much of a blunt instrument here.
It covers both the Concurrency runtime and the rest of the runtime, but we'd
like to be able to have e.g. a single-threaded Concurrency runtime while
the rest of the runtime is still thread safe (for instance).

So: rename it to SWIFT_STDLIB_SINGLE_THREADED_CONCURRENCY and make it just
control the Concurrency runtime, then add a SWIFT_STDLIB_THREADING_PACKAGE
setting at the CMake/build-script level, which defines
SWIFT_STDLIB_THREADING_xxx where xxx depends on the chosen threading package.

This is especially useful on systems where there may be a choice of threading
package that you could use.

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
dadcb04ae2 [Build][Runtime] Replace SWIFT_STDLIB_SINGLE_THREADED_RUNTIME.
SWIFT_STDLIB_SINGLE_THREADED_RUNTIME is too much of a blunt instrument here.
It covers both the Concurrency runtime and the rest of the runtime, but we'd
like to be able to have e.g. a single-threaded Concurrency runtime while
the rest of the runtime is still thread safe (for instance).

So: rename it to SWIFT_STDLIB_SINGLE_THREADED_CONCURRENCY and make it just
control the Concurrency runtime, then add a SWIFT_STDLIB_THREADING_PACKAGE
setting at the CMake/build-script level, which defines
SWIFT_STDLIB_THREADING_xxx where xxx depends on the chosen threading package.

This is especially useful on systems where there may be a choice of threading
package that you could use.

rdar://90776105
2022-05-24 14:57:38 +01:00
Kavon Farvardin
51f8cd161d gain isolation for static stored property initializer expressions
Some globals, like static stored properties, are lazily initialized.
For situations where we do a direct access to that property,
we will first call a function that tries to initialize the var if needed,
before returning the address of the global to perform the direct access.
In this specific case, we were not on the right actor when invoking
that function.

fixes rdar://83411416
2021-12-22 11:49:08 -08:00
Doug Gregor
150f32c690 Fix resilience of global actor hops and test MainActor.run. 2021-10-22 14:42:48 -07:00
Yuta Saito
722d790480 [test] mark multi-thread based tests as UNSUPPORTED in single-thread
Some of test cases assumes that the runtime is built for multi-threaded
platform.
2021-09-21 22:55:29 +00:00
Doug Gregor
3ee09a2298 Switch concurrency runtime tests to "REQUIRES: concurrency_runtime"
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.
2021-09-13 12:34:20 -07:00
Doug Gregor
eeeea49764 Remove -enable-experimental-concurrency almost everywhere. 2021-07-26 21:24:43 -07:00
Doug Gregor
1e2012d816 Disable availability checking in tests that use concurrency 2021-07-20 12:46:26 -07:00
Doug Gregor
4e306bb8ab Revert "[Test] Disable failing concurrency tests on Linux."
This reverts commit 766bf78eea.
2021-04-14 23:33:51 -07:00
Holly Borla
766bf78eea [Test] Disable failing concurrency tests on Linux. 2021-04-14 10:44:46 -07:00
Nate Chandler
ff7c98123a [Test] Disabled several Concurrency tests for back_deployment_runtime.
rdar://76566598
2021-04-13 15:27:41 -07:00
Karoy Lorentey
24aca4072a [test] Skip concurrency tests during back deployment testing
rdar://76038845
2021-03-30 22:35:38 -07:00
Doug Gregor
52096a640e SE-0302: Rename ConcurrentValue/@concurrent to Sendable/@Sendable. 2021-03-18 23:48:21 -07:00
Evan Wilde
12c3eb24c7 Verify that main is running on main thread
This patch adds a check to verify that we're running on the main thread
when running the async-main function.
2021-03-02 22:36:12 -08:00
Dario Rexin
e8b36abb63 [Concurrency] Enable concurrent global executor on non-Darwin platforms (#35871)
* [Concurrency] Enable concurrent global executor on non-Darwin platforms

* Fix runtime unittest build
2021-02-10 14:12:21 -08:00
Evan Wilde
8b80331c3d Updating tests to use actor
This patch updates the `actor class` spelling to `actor` in almost all
of the tests. There are places where I verify that we sanely handle
`actor` as an attribute though. These include:

 - test/decl/class/actor/basic.swift
 - test/decl/protocol/special/Actor.swift
 - test/SourceKit/CursorInfo/cursor_info_concurrency.swift
 - test/attr/attr_objc_async.swift
 - test/ModuleInterface/actor_protocol.swift
2021-02-10 08:09:13 -08:00
Kavon Farvardin
5a31eea203 simplify and enhance mainactor runtime test
1. removed dependency on CoreFoundation
2. removed use of `exit(:Int)` in favor
   of actually returning and exiting normally
3. added some returned values to make sure
   those are working fine.
2021-02-09 15:56:04 -08:00
Nate Chandler
3df7b67f1e [IRGen] Sign task resume context in swift_suspend_point.
rdar://72357371
2021-02-03 19:43:39 -08:00
Nate Chandler
53d8780ca0 [Test] Reenable most arm64e concurrency tests.
rdar://72357371
2021-02-03 08:25:52 -08:00
Doug Gregor
9efb44fde8 Adopt @concurrent in Task APIs 2021-01-28 10:03:09 -08:00
Arnold Schwaighofer
17109ccfc7 IRGen: Fix unreachable lowering in async functions
We need to add the coro.end intrinsic call for lowering to process
functions correctly.

rdar://73274012
2021-01-19 08:48:11 -08:00
Kavon Farvardin
adf223a052 disable mainactor test
there's an unseen failure in CI
2021-01-15 14:17:01 -08:00
Kavon Farvardin
dc218bbbe6 fixed MainActor executable regression test 2021-01-14 17:44:05 -08:00
Kavon Farvardin
91e2246c19 quick-and-dirty implementation of MainActor in the runtime system
it is "dirty" in the sense that we don't have proper support for
custom executors right now.
2021-01-14 17:43:58 -08:00
Mishal Shah
06350549f5 Update mainactor.swift 2021-01-08 11:49:30 -08:00
Kavon Farvardin
d531835f4c [concurrency] add executable test of MainActor 2021-01-06 15:01:22 -08:00