...
One approach for preventing data races in concurrent programming is the mutex. When properly observed by all threads, a mutex can provide safe and secure access to a shared object. However, mutexs provide no guarantees with regard to other objects that might be accessed when the mutex is not controlled by the accessing thread. Unfortunately, there is no portable way to determine which adjacent bit-fields may be stored along with the desired bit-field.
Another approach is to embed a concurrently accessed object inside a union alongside a long
object or other padding to ensure that the object insert a non-bit-field member between any two bit-fields to ensure that each bit-field is the only one accessed at that addresswithin its storage unit. This technique effectively guarantee guarantees that no two object bit-fields are accessed simultaneously.
...