Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Sources/Foundation/Thread.swift
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,16 @@ open class Thread : NSObject {
#if os(Windows)
open var stackSize: Int {
get {
// If we set a stack size for this thread.
// Otherwise, query the actual limits.
guard _attr.dwThreadStackReservation == 0 else {
return Int(_attr.dwThreadStackReservation)
}
var ulLowLimit: ULONG_PTR = 0
var ulHighLimit: ULONG_PTR = 0
GetCurrentThreadStackLimits(&ulLowLimit, &ulHighLimit)
return Int(ulLowLimit)
// Return the reserved stack span.
return Int(ulHighLimit - ulLowLimit)
}
set {
_attr.dwThreadStackReservation = DWORD(newValue)
Expand Down