Details
-
Bug
-
Status: Resolved
-
Not specified
-
Resolution: Fixed
-
None
-
None
Description
There are various multi threading patterns which frequently occur in our code, but there is often some confusion over whether critical sections/locks/memory barriers are required.
Some examples:
- Setting a boolean on one thread, and accessing from another. [And any reordering issues of code before/after]
- Incrementing a value from one thread and checking from another
- Decrementing a value from one thread and checking from another
- check boolean, get lock, check boolean again
- Reusing the same value set from another thread gives consistent values.
X86/64 is strongly ordered, but other platforms powerpc/arm may expose problems in the existing implementation.
One question is whether we need to switch to c++11 in order to obtain the necessary atomic memory ordering constraints.
jakesmith richardkchapman mckellyln for discussion...we should document best practice somewhere in the sources, and extend as we hit new examples.