Skip to content

Commit 11dbbd9

Browse files
authored
Windows: add ucrt support (imports + _getpid) (#29)
Windows support: import ucrt in RetryDelaySequence and Syscalls; use _getpid on Windows; build and tests succeed
1 parent e785f08 commit 11dbbd9

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Sources/GRPCCore/Call/Client/Internal/RetryDelaySequence.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public import Android // should be @usableFromInline
2121
public import Glibc // should be @usableFromInline
2222
#elseif canImport(Musl)
2323
public import Musl // should be @usableFromInline
24+
#elseif canImport(ucrt)
25+
public import ucrt // should be @usableFromInline
2426
#else
2527
#error("Unsupported OS")
2628
#endif

Sources/GRPCInProcessTransport/Syscalls.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ private import Android // should be @usableFromInline
2222
private import Glibc // should be @usableFromInline
2323
#elseif canImport(Musl)
2424
private import Musl // should be @usableFromInline
25+
#elseif canImport(ucrt)
26+
private import ucrt // should be @usableFromInline
2527
#else
2628
#error("Unsupported OS")
2729
#endif
@@ -40,6 +42,11 @@ enum System {
4042
#elseif canImport(Musl)
4143
let pid = Musl.getpid()
4244
return Int(pid)
45+
#elseif canImport(ucrt)
46+
let pid = ucrt._getpid()
47+
return Int(pid)
48+
#else
49+
return 0
4350
#endif
4451
}
4552
}

0 commit comments

Comments
 (0)