Skip to content

cabbaken/mini_cpp_concurrency_tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Modern C++ concurrency lib minimum tutorial

This is the road that I learn about c++ concurrency. There may be some mistakes, you can contact me through email([email protected]) or issue.

Intro

Modern C++ includes built-in support for:

It's confuse when you see these classes, and I will write this note to record my learning process.
(This is a simple tutorial for modern c++ beginner.)

Thread is the base of concurrency. Threads allow multiple functions to execute concurrently.

You know something about POSIX lock API such as pthread_mutex_init(), pthread_mutex_lock(), pthread_mutex_unlock().
The class std::mutex encapsulate pthread lock lib.

The class std::lock_guard is a mutex wrapper that provides a convenient RAII-style mechanism for owning a mutex for the duration of a scoped block.

The use of std::unique_lock is similar to std::mutex.

A condition variable is an object able to block the calling thread until notified to resume.

Here is something you need to transfer value between threads.

Reference

About

Get start with modern c++ concurrency

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published