https://github.com/microsoft/wil/blob/master/include/wil/result.h#L403-L430
Internal analysis suggests that this sequence is not entirely thread safe. Some options include:
- Use an srwlock-per-bucket (costs a function call)
- Figure out the right sequence of acquire/release semantics for reading the hashtable bucket entries' starting pointer
- Spin gently (using the platform's "yield" instructions as necessary)
- Deeper analysis to prove safety with annotations and documentation
Thanks to @sudhakar-vp-zz and @cpkleynhans for the analysis! (This is http://task.ms/58950594 for future explorers.)