2 thoughts on “Design Patterns – Part 4 published”

  1. Excellent article! very well written, I thought, however, you could improve your thread safe version by adding an additional check before locking the resource. If the s_instance variable is already set there would be no reason to lock the object. In effect a double check.

    if (s_instance == null)
    {
    lock (s_syncLock)
    {
    if (s_instance == null)
    {
    s_instance = new PrimeMinister();
    }
    }
    }
    return s_instance;

    cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *


*