请教一下CoroutineLite里面的一段代码。
来源:12-4 案例:仿官方框架实现调度器
慕前端9039556
2020-10-10

图中位置上的判断我觉得有点多余。 “= = =” 是比较引用地址。那么"!=="的意思应该是二者引用不相等。
由于上面:
combined = scopeContext + context + CoroutineName("@coroutine#${coroutineIndex.getAndIncrement()}")
根据CoroutineContext的plus函数可知它肯定是创建了新的CombinedContext,所以这里肯定是不会相等的。
写回答
2回答
-
把 + CoroutineName 放到 if else 后面就行了。给if else 加上括号。00
-
bennyhuo
2020-10-11
没错,这个主要是因为我为了调试在后面加了个CoroutineName,尴尬
00
相似问题