mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Concurrency] Rename ExecutorHooks.h, tidy up the interface.
`ExecutorHooks.h` is now nothing to do with hooks, so rename it. Also there are some additional functions it should declare, and a couple of places where we've slightly messed up the boundary, for instance `swift_task_asyncMainDrainQueue` was defined in `Task.cpp` rather than in the executor implementations, which is wrong, so fix that too. `CooperativeGlobalExecutor.cpp` now builds against the interface from `ExecutorImpl.h`, rather than including the all the concurrency headers. rdar://135380149
This commit is contained in:
@@ -18,20 +18,24 @@
|
||||
/// This file is included into GlobalExecutor.cpp only when both
|
||||
/// Dispatch integration and the cooperative global executor are disabled.
|
||||
/// It is expected to define the following functions:
|
||||
/// swift_task_asyncMainDrainQueueImpl
|
||||
/// swift_task_checkIsolatedImpl
|
||||
/// swift_task_donateThreadToGlobalExecutorUntilImpl
|
||||
/// swift_task_enqueueGlobalImpl
|
||||
/// swift_task_enqueueGlobalWithDeadlineImpl
|
||||
/// swift_task_enqueueGlobalWithDelayImpl
|
||||
/// swift_task_enqueueMainExecutorImpl
|
||||
/// swift_task_getMainExecutorImpl
|
||||
/// swift_task_isMainExecutorImpl
|
||||
///
|
||||
///===------------------------------------------------------------------===///
|
||||
|
||||
#include "swift/Runtime/Concurrency.h"
|
||||
#include "swift/Runtime/Debug.h"
|
||||
|
||||
#include "ExecutorHooks.h"
|
||||
|
||||
using namespace swift;
|
||||
#include "ExecutorImpl.h"
|
||||
|
||||
SWIFT_CC(swift)
|
||||
void swift::swift_task_enqueueGlobalImpl(Job *job) {
|
||||
void swift_task_enqueueGlobalImpl(SwiftJob *job) {
|
||||
assert(job && "no job provided");
|
||||
|
||||
swift_reportError(0, "operation unsupported without libdispatch: "
|
||||
@@ -39,8 +43,8 @@ void swift::swift_task_enqueueGlobalImpl(Job *job) {
|
||||
}
|
||||
|
||||
SWIFT_CC(swift)
|
||||
void swift::swift_task_enqueueGlobalWithDelayImpl(JobDelay delay,
|
||||
Job *job) {
|
||||
void swift_task_enqueueGlobalWithDelayImpl(SwiftJobDelay delay,
|
||||
SwiftJob *job) {
|
||||
assert(job && "no job provided");
|
||||
|
||||
swift_reportError(0, "operation unsupported without libdispatch: "
|
||||
@@ -48,11 +52,11 @@ void swift::swift_task_enqueueGlobalWithDelayImpl(JobDelay delay,
|
||||
}
|
||||
|
||||
SWIFT_CC(swift)
|
||||
void swift::swift_task_enqueueGlobalWithDeadlineImpl(long long sec,
|
||||
long long nsec,
|
||||
long long tsec,
|
||||
long long tnsec,
|
||||
int clock, Job *job) {
|
||||
void swift_task_enqueueGlobalWithDeadlineImpl(long long sec,
|
||||
long long nsec,
|
||||
long long tsec,
|
||||
long long tnsec,
|
||||
int clock, SwiftJob *job) {
|
||||
assert(job && "no job provided");
|
||||
|
||||
swift_reportError(0, "operation unsupported without libdispatch: "
|
||||
@@ -61,7 +65,7 @@ void swift::swift_task_enqueueGlobalWithDeadlineImpl(long long sec,
|
||||
|
||||
/// Enqueues a task on the main executor.
|
||||
SWIFT_CC(swift)
|
||||
void swift::swift_task_enqueueMainExecutorImpl(Job *job) {
|
||||
void swift_task_enqueueMainExecutorImpl(SwiftJob *job) {
|
||||
assert(job && "no job provided");
|
||||
|
||||
swift_reportError(0, "operation unsupported without libdispatch: "
|
||||
@@ -69,16 +73,29 @@ void swift::swift_task_enqueueMainExecutorImpl(Job *job) {
|
||||
}
|
||||
|
||||
SWIFT_CC(swift)
|
||||
void swift::swift_task_checkIsolatedImpl(SerialExecutorRef executor) {
|
||||
swift_task_invokeSwiftCheckIsolated(executor);
|
||||
void swift_task_checkIsolatedImpl(SwiftExecutorRef executor) {
|
||||
swift_executor_invokeSwiftCheckIsolated(executor);
|
||||
}
|
||||
|
||||
SWIFT_CC(swift)
|
||||
SerialExecutorRef swift::swift_task_getMainExecutorImpl() {
|
||||
return SerialExecutorRef::generic();
|
||||
SwiftExecutorRef swift_task_getMainExecutorImpl() {
|
||||
return swift_executor_generic();
|
||||
}
|
||||
|
||||
SWIFT_CC(swift)
|
||||
bool swift::swift_task_isMainExecutorImpl(SerialExecutorRef executor) {
|
||||
return executor.isGeneric();
|
||||
bool swift_task_isMainExecutorImpl(SwiftExecutorRef executor) {
|
||||
return swift_executor_isGeneric(executor);
|
||||
}
|
||||
|
||||
SWIFT_RUNTIME_ATTRIBUTE_NORETURN SWIFT_CC(swift)
|
||||
void swift_task_asyncMainDrainQueueImpll() {
|
||||
swift_reportError(0, "operation unsupported without libdispatch: "
|
||||
"swift_task_asyncMainDrainQueue");
|
||||
}
|
||||
|
||||
SWIFT_CC(swift) void
|
||||
swift_task_donateThreadToGlobalExecutorUntilImpl(bool (*condition)(void *),
|
||||
void *conditionContext) {
|
||||
swift_reportError(0, "operation unsupported: "
|
||||
"swift_task_donateThreadToGlobalExecutorUntilImpl");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user