Unsynchronized int access from threads

Steven Schveighoffer schveiguy at gmail.com
Fri Jun 19 11:57:56 UTC 2020


On 6/19/20 1:54 AM, H. S. Teoh wrote:
> What I meant is that I'm thinking of optimizing at a higher level, to
> arrange it in such a way that I don't need to lock. E.g., if scanning
> for zeroes can't easily multithread with updating the array, perhaps the
> better way to do it is to let them run sequentially, but multithread
> across multiple instances of the computation instead.

Atomic reads/writes are not as heavy as locks. Though certainly if there 
are better ways to organize the code, that might be more fruitful.

-Steve


More information about the Digitalmars-d mailing list