Skip to content

Commit 3c75f2f

Browse files
authored
Add comment explaining #if guard
1 parent 49a20d1 commit 3c75f2f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

stdlib/public/Concurrency/TaskGroup.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ class TaskGroupBase : public TaskGroupTaskStatusRecord {
292292
};
293293

294294
protected:
295+
// Guard with SWIFT_THREADING_NONE and not just SWIFT_STDLIB_SINGLE_THREADED_CONCURRENCY
296+
// because the latter just means that the global executor is cooperative,
297+
// but it doesn't mean that the target platform is always single-threaded. For example, on
298+
// wasm32-unknown-wasip1-threads, the global executor is cooperative, but users can still set up their
299+
// own TaskExecutor with multiple threads.
295300
#if SWIFT_THREADING_NONE || SWIFT_CONCURRENCY_TASK_TO_THREAD_MODEL
296301
// Synchronization is simple here. In a single threaded mode, all swift tasks
297302
// run on a single thread so no coordination is needed. In a task-to-thread

0 commit comments

Comments
 (0)