On Sunday, 26 May 2024 at 20:00:50 UTC, Jonathan M Davis wrote:
No operation on an associative array is thread-safe. As such, you should not be doing _any_ operation on a shared AA without first locking a mutex to protect it. Then you need to cast away shared to access or mutate it or do whatever it is you want to do with it other than pass it around. And then when you're done, you make sure that no thread-local references to the AA exist, and you release the mutex.
...

Thank you, that's exactly the big picture explanation I was hoping for.

For others wrestling with this issue, I found out how to cast to unshared at this article:

https://forum.dlang.org/thread/jwasqvrvkpqzimlut...@forum.dlang.org

Andy

  • Problem with cle... Andy Valencia via Digitalmars-d-learn
    • Re: Problem... Jonathan M Davis via Digitalmars-d-learn
    • Re: Problem... Andy Valencia via Digitalmars-d-learn
      • Re: Pro... Serg Gini via Digitalmars-d-learn
        • Re:... mw via Digitalmars-d-learn
          • ... Andy Valencia via Digitalmars-d-learn
            • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn

Reply via email to