That sounds expected to me. While Array values are thread-safe, writing to the global variable 'array' from two different threads would be a race. You can see this properly diagnosed if you enable Thread Sanitizer.
Jordan P.S. bugs.swift.org should be back up now, if you find any other issues. > On Jan 8, 2018, at 11:02, Fadi Botros via swift-users > <swift-users@swift.org> wrote: > > I'm on macOS Sierra 10.12.6, and using Swift 4.0 > Tried to access the array concurrently to see whether is it synchronized or no > import Foundation let global = DispatchQueue.global() var array: [Int] = [ - > Pastebin.com <https://pastebin.com/PnvyM3Qn> > > > import Foundation let global = DispatchQueue.global() var array: [Int... > <https://pastebin.com/PnvyM3Qn> > > When tried to run it using the terminal > This crash happened > > swift(69836,0x700002dc2000) malloc: *** error for object 0x7ffe4be237e0: > pointer - Pastebin.com <https://pastebin.com/vrdKTfrP> > > > swift(69836,0x700002dc2000) malloc: *** error for object 0x7ffe4be237e0: po... > <https://pastebin.com/vrdKTfrP> > > Avoided this crash using Serial Dispatch Queue > > let otherDispatch = DispatchQueue(label: "another.dispatch.com", > qos: .default) > func appending(_ i: Int) { > otherDispatch.sync { array.append(i) } > } > > > > Also tried to file this issue on bugs.swift.org, and it appears your site is > down (under maintainence) > > Sorry > _______________________________________________ > swift-users mailing list > swift-users@swift.org > https://lists.swift.org/mailman/listinfo/swift-users
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users