C++11/14/17/20 Concurrency Demystified: From Core Principles to Thread-Safe Code
See the code| 头文件 | 说明 |
|---|---|
| <thread>、<stop_token> | 线程 |
| <mutex>、<shared_mutex> | 锁 |
| <condition_variable> | 条件变量 |
| <semaphore> | 信号量 |
| <barrier>、<latch> | 屏障 |
| <future> | 异步处理的结果 |
| <chrono> | 时钟 |
| <ratio> | 编译期有理数算数 |
| <atomic> | 原子类型和原子操作 |
| <execution> | 标准库算法执行策略 |
| 特性 | API |
|---|---|
| thread | std::thread |
| mutex | std::mutex、std::lock_guard、std::unique_lock |
| condition variable | std::condition_variable、std::condition_variable_any |
| atomic | std::atomic、std::atomic_thread_fence |
| future | std::future、std::shared_future |
| interruption | 无 |
| 特性 | API |
|---|---|
| thread | boost::thread |
| mutex | boost::mutex、boost::lock_guard、boost::unique_lock |
| condition variable | boost::condition_variable、boost::condition_variable_any |
| atomic | 无 |
| future | boost::future、boost::shared_future |
| interruption | thread::interrupt |
| 特性 | API |
|---|---|
| thread | pthread_create、pthread_detach、pthread_join |
| mutex | pthread_mutex_lock、pthread_mutex_unlock |
| condition variable | pthread_cond_wait、pthread_cond_signal |
| atomic | 无 |
| future | 无 |
| interruption | pthread_cancel |
| 特性 | API |
|---|---|
| thread | java.lang.Thread |
| mutex | synchronized blocks |
| condition variable | java.lang.Object.wait、java.lang.Object.notify |
| atomic | volatile 变量、java.util.concurrent.atomic |
| future | java.util.concurrent.Future |
| interruption | java.lang.Thread.interrupt |
| 线程安全的容器 | java.util.concurrent 中的容器 |
| 线程池 | java.util.concurrent.ThreadPoolExecutor |
142 followers · starred Nov 2022
59 followers · starred Apr 2022
112 followers · starred Aug 2022
26 followers · starred May 2021
C++11/14/17/20 Concurrency Demystified: From Core Principles to Thread-Safe Code
See the code| 头文件 | 说明 |
|---|---|
| <thread>、<stop_token> | 线程 |
| <mutex>、<shared_mutex> | 锁 |
| <condition_variable> | 条件变量 |
| <semaphore> | 信号量 |
| <barrier>、<latch> | 屏障 |
| <future> | 异步处理的结果 |
| <chrono> | 时钟 |
| <ratio> | 编译期有理数算数 |
| <atomic> | 原子类型和原子操作 |
| <execution> | 标准库算法执行策略 |
| 特性 | API |
|---|---|
| thread | std::thread |
| mutex | std::mutex、std::lock_guard、std::unique_lock |
| condition variable | std::condition_variable、std::condition_variable_any |
| atomic | std::atomic、std::atomic_thread_fence |
| future | std::future、std::shared_future |
| interruption | 无 |
| 特性 | API |
|---|---|
| thread | boost::thread |
| mutex | boost::mutex、boost::lock_guard、boost::unique_lock |
| condition variable | boost::condition_variable、boost::condition_variable_any |
| atomic | 无 |
| future | boost::future、boost::shared_future |
| interruption | thread::interrupt |
| 特性 | API |
|---|---|
| thread | pthread_create、pthread_detach、pthread_join |
| mutex | pthread_mutex_lock、pthread_mutex_unlock |
| condition variable | pthread_cond_wait、pthread_cond_signal |
| atomic | 无 |
| future | 无 |
| interruption | pthread_cancel |
| 特性 | API |
|---|---|
| thread | java.lang.Thread |
| mutex | synchronized blocks |
| condition variable | java.lang.Object.wait、java.lang.Object.notify |
| atomic | volatile 变量、java.util.concurrent.atomic |
| future | java.util.concurrent.Future |
| interruption | java.lang.Thread.interrupt |
| 线程安全的容器 | java.util.concurrent 中的容器 |
| 线程池 | java.util.concurrent.ThreadPoolExecutor |
142 followers · starred Nov 2022
59 followers · starred Apr 2022
112 followers · starred Aug 2022
26 followers · starred May 2021