Skip to content

worker中使用poll与主框架进行双向通信

likepeng edited this page Jun 5, 2023 · 1 revision

worker中的实现

  • Init: 发送kWaitForMsg给主框架
  • Run: 使用poll监听cmd_channel中fd的消息和其它外部的fd
  • Run: cmd_channel接收分发消息
  • Run:接收到kRunWithMsg,发送kWaitForMsg消息继续监听主框架发来的消息
  • Run:接收到kRun消息忽略

Q1 主框架同时回复kRun和kRunWithMsg

  • 不能使用DispatchMsg,因为可能捕捉到kRunWithMsg消息导致无法回复

Clone this wiki locally