I was reading one of the examples and I saw what looked like code that could result in a race condition but I haven't worked with atomics much so I may be mistaken. I'm just raising it in case someone who knows more than me could take a look. Based on my understanding this code could read the value increment it and then before it writes it back it gets incremented somewhere else and the increment is lost. Might be better to use fetch_add to increment the value in an "atomic" way. Let me know if that makes sense I should be able to do a PR quickly to fix it.
I was reading one of the examples and I saw what looked like code that could result in a race condition but I haven't worked with atomics much so I may be mistaken. I'm just raising it in case someone who knows more than me could take a look. Based on my understanding this code could read the value increment it and then before it writes it back it gets incremented somewhere else and the increment is lost. Might be better to use fetch_add to increment the value in an "atomic" way. Let me know if that makes sense I should be able to do a PR quickly to fix it.