On Tuesday, 3 December 2024 at 23:16:00 UTC, Richard (Rikki) Andrew Cattermole wrote:
What owned by a thread means is that a pointer is guaranteed to only be accessible by that thread. I.e. the cpu will segfault if you try to access it from another thread.

My experience is that aside from thread-local module globals, all other objects you create can be subsequently cast to shared and then sent on to another thread. It can be accessed on the receiving thread as such, or cast back to un-shared and used as just another private data structure.

In fact, parts of Phobos will not work with objects having a shared attribute. So you have to be careful about transferring ownership for such data structures, and verifying your code path guarantees exclusive access before casting it back to unshared.

Andy

      • Re: Var... Andy Valencia via Digitalmars-d-learn
      • Re: Var... Salih Dincer via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
          • ... Salih Dincer via Digitalmars-d-learn
            • ... Ali Çehreli via Digitalmars-d-learn
            • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... Nick Treleaven via Digitalmars-d-learn
              • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... Ali Çehreli via Digitalmars-d-learn
              • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... Andy Valencia via Digitalmars-d-learn
  • Re: Variable mod... Salih Dincer via Digitalmars-d-learn

Reply via email to