mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
`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
68 lines
2.2 KiB
C++
68 lines
2.2 KiB
C++
//===--- Concurrency.h - Runtime interface for concurrency ------*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2024 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Hooks for concurrency
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// To use this file, define the following macros:
|
|
//
|
|
// SWIFT_CONCURRENCY_HOOK(returnType, name, ...)
|
|
// SWIFT_CONCURRENCY_HOOK0(returnType, name)
|
|
// SWIFT_CONCURRENCY_HOOK_OVERRIDE0(returnType, name)
|
|
//
|
|
// Then include the file somewhere.
|
|
|
|
#ifndef SWIFT_CONCURRENCY_HOOK
|
|
#define SWIFT_CONCURRENCY_HOOK(returnType, name, ...)
|
|
#endif
|
|
|
|
#ifndef SWIFT_CONCURRENCY_HOOK0
|
|
#define SWIFT_CONCURRENCY_HOOK0(returnType, name)
|
|
#endif
|
|
|
|
// .............................................................................
|
|
|
|
SWIFT_CONCURRENCY_HOOK(void, swift_task_enqueueGlobal, Job *job);
|
|
|
|
SWIFT_CONCURRENCY_HOOK(void, swift_task_enqueueGlobalWithDelay,
|
|
unsigned long long delay, Job *job);
|
|
|
|
SWIFT_CONCURRENCY_HOOK(void, swift_task_enqueueGlobalWithDeadline,
|
|
long long sec,
|
|
long long nsec,
|
|
long long tsec,
|
|
long long tnsec,
|
|
int clock, Job *job);
|
|
|
|
SWIFT_CONCURRENCY_HOOK(void, swift_task_checkIsolated, SerialExecutorRef executor);
|
|
|
|
SWIFT_CONCURRENCY_HOOK(bool, swift_task_isOnExecutor,
|
|
HeapObject *executor,
|
|
const Metadata *selfType,
|
|
const SerialExecutorWitnessTable *wtable);
|
|
|
|
SWIFT_CONCURRENCY_HOOK(void, swift_task_enqueueMainExecutor, Job *job);
|
|
|
|
SWIFT_CONCURRENCY_HOOK0(SerialExecutorRef, swift_task_getMainExecutor);
|
|
|
|
SWIFT_CONCURRENCY_HOOK(bool, swift_task_isMainExecutor, SerialExecutorRef);
|
|
|
|
SWIFT_CONCURRENCY_HOOK(void, swift_task_donateThreadToGlobalExecutorUntil,
|
|
bool (*condition)(void *), void *context);
|
|
|
|
// .............................................................................
|
|
|
|
#undef SWIFT_CONCURRENCY_HOOK
|
|
#undef SWIFT_CONCURRENCY_HOOK0
|
|
#undef SWIFT_CONCURRENCY_HOOK_OVERRIDE0
|