Skip to content

Latest commit

 

History

History
80 lines (65 loc) · 10.5 KB

README.md

File metadata and controls

80 lines (65 loc) · 10.5 KB
  1. 线程管理(Managing thread)<thread>
  2. 线程间共享数据(Sharing data between thread)<mutex><shared_mutex>
  3. 同步并发操作(Synchronizing concurrent operation)<condition_variable><semaphore><barrier><latch><future><chrono><ratio>
  4. C++ 内存模型和基于原子类型的操作(The C++ memory model and operations on atomic type)<atomic>

并发编程实践

  1. 基于锁的并发数据结构的设计(Designing lock-based concurrent data structure)
  2. 无锁并发数据结构的设计(Designing lock-free concurrent data structure)
  3. 并发代码的设计(Designing concurrent code)
  4. 高级线程管理(Advanced thread management)
  5. 并行算法(Parallel algorithm)<execution>
  6. 多线程应用的测试与调试(Testing and debugging multithreaded application)

标准库相关头文件

头文件 说明
<thread><stop_token> 线程
<mutex><shared_mutex>
<condition_variable> 条件变量
<semaphore> 信号量
<barrier><latch> 屏障
<future> 异步处理的结果
<chrono> 时钟
<ratio> 编译期有理数算数
<atomic> 原子类型和原子操作
<execution> 标准库算法执行策略

并发库对比

特性 API
thread std::thread
mutex std::mutexstd::lock_guardstd::unique_lock
condition variable std::condition_variablestd::condition_variable_any
atomic std::atomicstd::atomic_thread_fence
future std::futurestd::shared_future
interruption
特性 API
thread boost::thread
mutex boost::mutexboost::lock_guardboost::unique_lock
condition variable boost::condition_variableboost::condition_variable_any
atomic
future boost::futureboost::shared_future
interruption thread::interrupt
特性 API
thread pthread_createpthread_detachpthread_join
mutex pthread_mutex_lock、pthread_mutex_unlock
condition variable pthread_cond_waitpthread_cond_signal
atomic
future
interruption pthread_cancel
特性 API
thread java.lang.Thread
mutex synchronized blocks
condition variable java.lang.Object.waitjava.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