You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calendar in swift-corelibs-foundation seems to have a thread-safety issue that is not present in Darwin Foundation.
The following code works fine on Darwin but crashes on Linux:
import Foundation
func makeCalendar()->Calendar{varcal=Calendar(identifier:.gregorian)
cal.timeZone =.init(secondsFromGMT:0)!
return cal
}letcalendar=makeCalendar()// If a new calendar is created on every access, things work fine.//var calendar: Calendar { makeCalendar() }DispatchQueue.concurrentPerform(iterations:50){ iter in
_ = calendar.startOfDay(for:Date())}
If the let calendar = ... is replaced by the computed var two lines below, the code works fine on linux as well.
Environment
Docker image: swift:5.4.2-focal
Swift version 5.4 (swift-5.4-RELEASE)
Target: x86_64-unknown-linux-gnu
Additional Detail from JIRA
md5: 0eb37680f4fb29e7176edb2f77dddea0
duplicates:
Issue Description:
Calendar in swift-corelibs-foundation seems to have a thread-safety issue that is not present in Darwin Foundation.
The following code works fine on Darwin but crashes on Linux:
If the
let calendar = ...
is replaced by the computed var two lines below, the code works fine on linux as well.Backtrace of the execution on linux:
The text was updated successfully, but these errors were encountered: