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
In `in_parallel_with_slice()`, there's a `&mut *input.0` that creates
a `&mut [I]` of the whole slice in `Input`. The same value is created
in multiple threads, thus potentially resulting in multiple threads
having mutable references to the same value.
This patch fixes that by instead only getting mutable pointers to
individual values. It does so by storing a `*mut T` in `Input` instead
of the current `*mut [I]`, and then using `pointer::add()` to get
pointers to individual elements.
Thanks to @Ralith for bringing this up and proposing the solution in
our review of unsafe code at Google.
0 commit comments