Singleton

The Singleton: The Alternatives Monostate Pattern and Dependency Injection

So far, I have discussed in my previous posts the Singleton Pattern, and its pros and cons. One question is still open: What alternatives for the Singleton Pattern are available? Today, I write about the Monostate Pattern and Dependency Injection.

Read more
Views: 8861

The Singleton: Pros and Cons

I introduced in my last post "The Singleton", the classical Singleton and the so-called Meyers Singleton. The Singleton Pattern is highly controversial. Let me, therefore, discuss in this post the pros and cons of the Singleton.

Read more
Tags: Singleton
Views: 10167

The Singleton

The most controversial Design Pattern from the book  "Design Patterns: Elements of Reusable Object-Oriented Software" is the Singleton Pattern. Let me introduce it before I discuss its pros and cons.

Read more
Tags: Singleton
Views: 13092

Thread-Safe Initialization of a Singleton

There are a lot of issues with the singleton pattern. I'm totally aware of that. But the singleton pattern is an ideal use case for a variable, which has only to be initialized in a thread-safe way. From that point on you can use it without synchronization. So in this post, I discuss different ways to initialize a singleton in a multithreading environment. You get the performance numbers and can reason about your uses cases for the thread-safe initialization of a variable.

Read more
Views: 356166

Thread-Safe Initialization of Data

The story is simple if the data is not modified when shared between threads. The data has only to be initialized in the thread-safe way. It is not necessary to use an expensive lock for each access.

Read more
Views: 96998

Mentoring

Stay Informed about my Mentoring

 

English Books

Course: Modern C++ Concurrency in Practice

Course: C++ Standard Library including C++14 & C++17

Course: Embedded Programming with Modern C++

Course: Generic Programming (Templates)

Course: C++ Fundamentals for Professionals

Interactive Course: The All-in-One Guide to C++20

Subscribe to the newsletter (+ pdf bundle)

All tags

Blog archive

Source Code

Visitors

Today 1025

Yesterday 4552

Week 42139

Month 186310

All 11667464

Currently are 141 guests and no members online

Kubik-Rubik Joomla! Extensions

Latest comments