Variable modified by different threads.

Andy Valencia dont at spam.me
Mon Dec 2 04:31:28 UTC 2024


On Monday, 2 December 2024 at 02:29:39 UTC, Ali Çehreli wrote:
> I am not sure whether
>
>   stopRequested = true
>
> is correct even when there is a single writer of that variable. 
> There are several other methods of communicating the request. I 
> chose that one for this example.

I notice core.atomic has an atomicLoad() / atomicStore() pair of 
APIs which might be the "canonical" way to code in that fashion.

Andy



More information about the Digitalmars-d-learn mailing list