bkietz commented on code in PR #40237:
URL: https://github.com/apache/arrow/pull/40237#discussion_r1503181247
##########
cpp/src/arrow/array/data.cc:
##########
@@ -286,8 +286,10 @@ namespace {
template <typename offset_type>
BufferSpan OffsetsForScalar(uint8_t* scratch_space, offset_type value_size) {
auto* offsets = reinterpret_cast<offset_type*>(scratch_space);
- offsets[0] = 0;
- offsets[1] = static_cast<offset_type>(value_size);
+ reinterpret_cast<std::atomic<offset_type>*>(&offsets[0])
+ ->store(0, std::memory_order_relaxed);
+ reinterpret_cast<std::atomic<offset_type>*>(&offsets[1])
+ ->store(static_cast<offset_type>(value_size), std::memory_order_relaxed);
Review Comment:
Well it's true that some platforms need a mutex alongside the payload. If
it's necessary to support those, we should include a `util::Mutex` in
`ArraySpanFillFromScalarScratchSpace` and lock it whenever it's necessary to
mutate the scratch space.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]