CodingHanYa / workspace

workspace是基于C++11的轻量级异步执行框架,支持:通用任务异步并发执行、优先级任务调度、自适应动态线程池、高效静态线程池、异常处理机制等。
Apache License 2.0
1.03k stars 152 forks source link

workbranch::mission里访问workbranch::decline不用加锁吗? #30

Open FlyinCow opened 1 year ago

FlyinCow commented 1 year ago

include/workspace/workbranch.h:232里:

 while (true) {
            if (decline <= 0 && tq.try_pop(task)) { // 访问decline但是没有锁

decline应该是待删除的线程数吧,这里读它不用加锁吗,是为什么?

CodingHanYa commented 1 year ago

不用哦