Blocking Queue in C++ using a condition variable

A blocking Queue is a structure that allows you to put and take items from a Queue blocking if empty or if queue is full. In order to solve this problem in C++11 onwards we will use a condition_variable with an on the fly lambda. Read More…

Thread Safe Singleton in C++

This article is about how to create a thread safe Singleton in C++. There are three basic patterns we will discuss, Double Checked Locking and why its bad, the Myers Singleton and the OnceFlag Singleton. Read More…

C++ Asynch future promise package_task and shared_future

A Future is a concept where we run a method to do something and then the Future returns a prescribed value when the Future has completed its work. As with other languages a C++ std::future blocks until the value is ready. Futures also crop up in other contexts which we will discuss such as a std::promise a std::packaged_task and std::shared_future Read More…

Capturing Thread Exceptions in C++

When a thread runs in C++ how do you catch the exception that thread threw ? You can not just do try catch because the exception is in the thread of execution. Read on to find out how to determine the exception. Read More…

C++ Interview Questions

Given I have worked for most of the worlds largest investment banks and have had to go through many interviews myself and Interview many developers I thought I would create a list of sample C++ interview questions that I have been asked and that I have asked at interview. Read More…

C++ Mutex and Preventing Race conditions

When writing multi threaded code one of the big things you must be careful of is race conditions. In this article I will talk about what they are and present a simple solution that can assist you in preventing these conditions.
Read More…

Creating C++ threads

3 Simple ways to create threads in C++. Read More…

By clicking Dismiss you accept that you may get a cookie that is used to improve your user experience and for analytics.
All data is anonymised. Our privacy page is here =>
Privacy Policy
This message is required under GDPR (General Data Protection Rules ) and the ICO (Information Commissioners Office).