Objective-C has atomic properties, it ensures safe read and writes to a property from different threads. Since Go is multithreaded, it supports atomic operations as well. Pointer is a great way to bring atomic memory primitives into your program. It is a simple way to prevent data races without fancy mutex code in place. The code with atomic pointers returned no feedback regarding a data race.

4m read timeFrom medium.com
Post cover image
Table of contents
Atomic Pointers in Go 1.19The atomic.PointerMy Atomic Pointer use caseData RaceConclusion

Sort: