Skip to content

How to use an ArcArray across threads? #1046

Answered by jturner314
multimeric asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, that's correct. The data of an ArcArray is wrapped in an Arc. It's similar to Arc<Array<A, D>>, except that:

  • The shape/strides/pointer are uniquely owned by the ArcArray, not wrapped in the Arc. Only the data is wrapped in the Arc. As a result, for example, calling .slice_collapse() on an ArcArray modifies its shape/strides/pointer in-place without cloning the data. In contrast, if you had an Arc<Array<A, D>> and wanted to call .slice_collapse(), you'd have to call .make_mut() (which would clone the wrapped array, including its data) to get a mutable reference in order to modify the shape/strides/pointer.

  • When modifying the data in the ArcArray (or getting a mutable reference to …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by multimeric
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants