`vtkBitArray` is not thread-safe
The vtkBitArray
class stores bit values in an internal unsigned char
array where each byte holds 8 bit values. When setting values in this array, bitshift and bitwise operators are used to flip certain bit values of the corresponding bytes of the underlying unsigned char
array.
As such, when processing in a multi-threaded context, multiple threads may look to modify bit values in close proximity to each other leading to a simultaneous modification of the same unsigned char
. This leads to undefined behavior since the same memory address is modified by two concurrent threads.
This problem is mostly relevant in the vtkHyperTreeGrid
framework where the internal masking mechanism is controlled through a vtkBitArray
.
Edited by Julien Fausty