mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Freestanding] Use task-to-thread concurrency model.
Defined SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY to describe whether the standard library will use the task-to-thread model for concurrency. It is true only for freestanding non-Darwin stdlibs. When it is true, SWIFT_CONCURRENCY_TASK_TO_THREAD_MODEL is defined during stdlib compilation of both Swift and C++ sources. Added an option to LangOptions to specify which concurrency model is used, either standard or task-to-thread. When SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY is true, the model is specified to be task-to-thread.
This commit is contained in:
@@ -1018,6 +1018,14 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
|
||||
Opts.DumpTypeWitnessSystems = Args.hasArg(OPT_dump_type_witness_systems);
|
||||
|
||||
if (const Arg *A = Args.getLastArg(options::OPT_concurrency_model)) {
|
||||
Opts.ActiveConcurrencyModel =
|
||||
llvm::StringSwitch<ConcurrencyModel>(A->getValue())
|
||||
.Case("standard", ConcurrencyModel::Standard)
|
||||
.Case("task-to-thread", ConcurrencyModel::TaskToThread)
|
||||
.Default(ConcurrencyModel::Standard);
|
||||
}
|
||||
|
||||
return HadError || UnsupportedOS || UnsupportedArch;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user