Something I've always wondered - in the futures packages (<a href="https://github.com/Workiva/go-datastructures/blob/master/futures/futures.go" rel="nofollow">https://github.com/Workiva/go-datastructures/blob/master/fut...</a>):<p>The author has a variable `triggered` to check the state of whether or not the future is complete. Now to protect that variable from data races, the author uses a standard lock. Now since you need to protect a simple value what I would do in this situation is use an atomic variable w/ atomic.StoreInt32 (you could also probably not even have to use an atomic load in GetResult).<p>Of course the best option would be to benchmark (and I'm assuming the author did, given that the structures are performant), but I'm wondering if my "gut" is right and under what situations others have seen that would necessitate a lock vs. an atomic instruction (high contention on readers, few writers)?