Skip to content

Commit 1e8f117

Browse files
committed
[6.2]: Add platform executor module for FreeBSD
Swift concurrency defines a default platform executor. This was not defined for FreeBSD resulting in build failures. Defining it to use the Dispatch executor. Scope: This only impacts FreeBSD. Risk: Low. This change only affects FreeBSD. Reviewers: @compnerd, @KTSO, @al45tair Testing: Local testing to ensure Concurrency builds on FreeBSD. Fixes: rdar://150643436 (cherry picked from commit 4a41e50)
1 parent e767e7f commit 1e8f117

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

Runtimes/Core/Concurrency/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ add_library(swift_Concurrency
8181
PartialAsyncTask.swift
8282
PlatformExecutorDarwin.swift
8383
PlatformExecutorLinux.swift
84+
PlatformExecutorFreeBSD.swift
8485
PlatformExecutorWindows.swift
8586
PriorityQueue.swift
8687
SourceCompatibilityShims.swift

stdlib/public/Concurrency/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ set(SWIFT_RUNTIME_CONCURRENCY_SWIFT_SOURCES
164164
PlatformExecutorDarwin.swift
165165
PlatformExecutorLinux.swift
166166
PlatformExecutorWindows.swift
167+
PlatformExecutorFreeBSD.swift
167168
)
168169

169170
set(SWIFT_RUNTIME_CONCURRENCY_NONEMBEDDED_C_SOURCES
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2020 - 2025 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#if !$Embedded && os(FreeBSD)
14+
15+
import Swift
16+
17+
// The default executors for now are Dispatch-based
18+
@available(SwiftStdlib 6.2, *)
19+
public struct PlatformExecutorFactory: ExecutorFactory {
20+
public static let mainExecutor: any MainExecutor = DispatchMainExecutor()
21+
public static let defaultExecutor: any TaskExecutor
22+
= DispatchGlobalTaskExecutor()
23+
}
24+
25+
#endif // os(FreeBSD)

0 commit comments

Comments
 (0)