On 13 Sep 2016, at 05:03, Gerriet M. Denkmann via swift-users 
<swift-users@swift.org> wrote:

> Or is the code fundamentally wrong …?

This one.

You’re accessing a mutable value (`bitfield`) from multiple threads.  Swift 
does not support that, even in situations like this where you’re sure that the 
items are preallocated and that the threads are accessing non-overlapping 
values.

As to how you fix this, it kinda depends on your final use for the array.  If 
you’re OK with the results being split into per-thread chunks, you can have 
each thread work on its own chunk and then pass the results back to the ‘main’ 
thread when it’s done.  OTOH, if you need your results in one big array, things 
get tricky.

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to