摘要: 对共享的资源或者数据做加锁处理 在多线程的环境下,有时需要多个线程对同一个资源或者数据进行操作,如果没有加锁,容易出现未定义的行为。 比如: #include <iostream> #include <string> #include <thread> #include <mutex> using 阅读全文
posted @ 2022-05-17 11:49 strive-sun 阅读(83) 评论(0) 推荐(0) 编辑