Commit Graph

17 Commits

Author SHA1 Message Date
Guillaume Lessard
92b54e6434 [concurrency] fix availability of new executor symbols 2025-10-16 21:29:51 -07:00
Alastair Houghton
ff8d2fa80c [Concurrency] Support continuous waits in CooperativeExecutor.
This fixes some WASM tests.
2025-08-26 09:38:14 +01:00
Alastair Houghton
bd27a14ea0 [Concurrency] Fix cooperative executor to return only after all jobs run.
We were terminating after the first set of jobs; if one of them scheduled
another job, and there were no timers running, we would terminate,
which was wrong.
2025-08-26 09:38:13 +01:00
Alastair Houghton
d0b3d14c68 [Concurrency] Don't expose Dispatch or CF executors directly.
Also add `final` to the `CooperativeExecutor` declaration.
2025-08-26 09:38:13 +01:00
Alastair Houghton
0fbd382e9c [Concurrency] Fix CooperativeExecutor to not loop forever.
If a job enqueues another job on the executor, we might never leave
the inner `while` loop in the `run()` method.  Fix this by taking
the contents of the run queue and only running those jobs in the
queue at the time we enter the inner loop.
2025-08-26 09:38:13 +01:00
Alastair Houghton
871a062002 [Concurrency] Remove canonicalization code.
I don't think we actually need this.  If you have a non-canonical
(i.e. derived) clock, you can just implement `enqueue` and/or `run`
and call those methods on the clock you're wrapping.
2025-08-26 09:38:13 +01:00
Alastair Houghton
6046286b58 [Concurrency] Updates after second SE pitch.
We no longer attempt to convert timestamps from the passed-in `Clock`
in order to allow any clock to work with any executor.  Instead,
executors that do not recognise a clock should call the `enqueue`
function on that `Clock`, which lets the `Clock` itself decide how
to proceed.

Additionally, rename `SchedulableExecutor` to `SchedulingExecutor`.
2025-08-26 09:38:11 +01:00
Alastair Houghton
42ca1b1cc8 Rename SwiftStdlibCurrentOS to StdlibDeploymentTarget.
`StdlibDeploymentTarget` seems to be a better name.

rdar://152498657
2025-06-04 10:40:19 +01:00
Alastair Houghton
28f96e64ab [Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.
If you use SwiftStdlibCurrentOS availability, you will be able to
use new types and functions from within the implementation. This
works by, when appropriate, building with the CurrentOS availability
set to the current deployment target.

rdar://150944675
2025-05-12 12:07:24 +01:00
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
c20aa667f2 [Concurrency] Disable various things for task-to-thread model.
When in task-to-thread model concurrency mode, there is no `MainActor`
and we cannot use `ExecutorJob`, so disable various things.

rdar://141348916
2025-03-19 11:15:00 +00:00
Alastair Houghton
0da95eb20d [Concurrency] Fix some warnings, use typed throws.
Fix a couple of `unsafe` warnings.

Also update `withUnsafeExecutorPrivateData` to use typed throws instead of
`rethrow`.

rdar://141348916
2025-03-18 18:37:31 +00:00
Alastair Houghton
fb0396c509 [Concurrency] Fall back to allocating from the heap, fix a test.
`CooperativeExecutor` should fall back to heap allocations if the task
allocator isn't available when it's enqueuing delayed jobs.

Also, remove the reference to `DispatchGlobalExecutor` from the
custom executor test.

rdar://141348916
2025-03-18 17:59:57 +00:00
Alastair Houghton
60fb31cf01 [Concurrency][32-bit] Store timestamp out-of-line on 32-bit.
CooperativeExecutor needs to store its timestamp out-of-line for
32-bit architectures (like WASI).

rdar://141348916
2025-03-18 15:46:51 +00:00
Alastair Houghton
ed08858998 [Concurrency] Fix availability.
Fix up availability after the non-Darwin changes.  Also update the
ABI baseline.

Fix a Win32 typo.

rdar://141348916
2025-03-17 16:24:06 +00:00
Alastair Houghton
f0defd83bd [Concurrency] Add CooperativeExecutor, use it.
Also tweak the sleep implementations to let the hooks run if there
isn't a `SchedulableExecutor` (for hooked mode).

rdar://141348916
2025-03-17 13:10:35 +00:00