Open swift-ci opened 5 years ago
Comment by Andrey Ulanov (JIRA)
If you look at CFCalendar source code (https://github.com/apple/swift-corelibs-foundation/blob/master/CoreFoundation/Locale.subproj/CFCalendar.c) you'll see other code that is not thread-safe since it uses calendar->_cal as a temporary storage. The PR above only fixes the CFCalendarGetTimeRangeOfUnit invocation. I can see that at least the following CFCalendar functions will have the same problem:
CFCalendarAddComponentsV()
CFCalendarGetComponentDifferenceV()
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Foundation | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 2773525e087aef23e6a04ba1cce9607dis duplicated by:
Issue Description:
I'm getting unpredictable results when invoking Calendar.startOfDay() from parallel threads on the same Calendar object. This only happens on Linux. (I wasn't able to reproduce the problem on Darwin)
$ swift run
Precondition failed: file /home/cal/Sources/cal/main.swift, line 8
$