This is a collection of some modern skills for multithreading and concurrency in C++
- Mutex
SpinlockMutex: A simple mutex implementation based onstd::atomic_flag::test_and_setDataMutex: A Rust-style mutex in C++
- Task Queue
SimpleSerialTaskQueue: A simple serial queue implementationTaskQueue: A general task queue running tasks in parallel. The concept is similar toSimpleSerialTaskQueuebut it runs the tasks in several threads at the same time instead of running them sequentially
- Ring Buffer
SPSCRingBuffer: A thread-safe single-producer-single-consumer circular buffer
Run run.sh <FOLDER_NAME> to play the examples, where the <FOLDER_NAME> is mutex, task_queue, or ring_buffer. Or you can simply go to those folder then build examples by running make and clean them by make clean.
- An Introduction to Lock-Free Programming
- A Fast Lock-Free Queue for C++
- Data Plane Development Kit (DPDK)'s Ring Library
- Code here
- Linux Lockless Ring Buffer Design
- cameron314 / concurrentqueue
- facebook / folly / MPMCQueue
- Ring Implementation in FreeBSD*