File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -311,9 +311,12 @@ struct encoder {
311311 ST* encoded_integers,
312312 const factor_idx_t factor_idx,
313313 const exponent_idx_t exponent_idx) {
314- alignas (64 ) static PT ENCODED_VALUE_ARR[1024 ];
315- alignas (64 ) static PT VALUE_ARR_WITHOUT_SPECIALS[1024 ];
316- alignas (64 ) static UT TMP_INDEX_ARR[1024 ];
314+ // These arrays are thread_local static to ensure thread safety during multithreaded compression.
315+ // See: https://github.com/cwida/ALP/issues/41 for discussion.
316+ // Without thread_local, static arrays would be shared between threads, causing data races.
317+ alignas (64 ) thread_local static PT ENCODED_VALUE_ARR[1024 ];
318+ alignas (64 ) thread_local static PT VALUE_ARR_WITHOUT_SPECIALS[1024 ];
319+ alignas (64 ) thread_local static UT TMP_INDEX_ARR[1024 ];
317320
318321 exp_p_t current_exceptions_count {0 };
319322 uint64_t exceptions_idx {0 };
You can’t perform that action at this time.
0 commit comments