Gemini Flash 2.0 insists that I can pass an Atomic integer to a thread proc as is proc incrementMyAtomic(myAtomic: Atomic[int]) and nim will handle it using interior mutability
The compiler doesn't agree
The only way I am able to pass my atomic integer is by passing an its address and dereferencing it inside the function proc incrementMyAtomic(myAtomic: ptr Atomic[int])
Is there a way to acheive Gemini's way?
Chat for interested https://g.co/gemini/share/b4dd1dfb742d
If you want to get at least half-workable output from LLMs, you have to give them the relevant bits of documentation. Though, docs on atomics in Nim are rather sparse. In such cases C and C++ docs can often help wet neural nets such as one inside my skull.
Concurrent coordination requires accessing a specific "slot" in memory, not just a value. That's what pointers are for.