http://109.livejournal.com/ ([identity profile] 109.livejournal.com) wrote in [personal profile] juan_gandhi 2007-04-12 08:23 am (UTC)

во-от, а значит, чтобы и на железе с weak memory model работало, нужно просто барьер в нужный момент передёрнуть, типа:

    if (worker == null)
      lock (workerSyncRoot)
        if (worker == null)
        {
          My tempWorker = new MyImpl();
          Thread.MemoryBarrier();
          worker = tempWorker;
        }
    return worker;

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting