ZeroLiu2018 commented on issue #1497: URL: https://github.com/apache/incubator-brpc/issues/1497#issuecomment-962740435
> 第二点 调用sched(&g) 不一定是调度新的bthread的 也可能是旧的bthread的 举个更极端的例子 如果没有新的bthread呢 我说一下我的理解,先说第二点:除了 task_runner ,在 sche_to 里面,jump_stack 完成返回后,也会执行 _last_context_remained,也就是说在真正切到另一个 bthread 跑逻辑前,都会执行 _last_context_remained。 然后就是第一点,在第一点之前你可以看看切换 bthread 的逻辑,切换 bthread 之前有个 set_remained, 这个 remianed 的作用是将当前 bthread 放到队列。它也同样不是在原地执行,我想两者的原因是一样的(wait_for_butex 里面同样有将当前 bthread 入队的逻辑): 需要调度出新的 bthread 才能将旧 bthread 入列,否则,stack 切换可能很难处理。 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
