MCPcopy Create free account
hub / github.com/astercloud/aster / actorLoop

Method actorLoop

pkg/actor/system.go:463–484  ·  view source on GitHub ↗

actorLoop Actor 消息处理循环

(cell *actorCell)

Source from the content-addressed store, hash-verified

461
462// actorLoop Actor 消息处理循环
463func (s *System) actorLoop(cell *actorCell) {
464 defer s.wg.Done()
465 defer s.cleanupActor(cell)
466
467 cell.stateMu.Lock()
468 cell.state = actorStateRunning
469 cell.stateMu.Unlock()
470
471 for {
472 select {
473 case <-cell.ctx.Done():
474 return
475 case env := <-cell.mailbox:
476 s.processMessage(cell, env)
477
478 // 检查是否收到 PoisonPill
479 if _, ok := env.message.(*PoisonPill); ok {
480 return
481 }
482 }
483 }
484}
485
486// processMessage 处理单条消息
487func (s *System) processMessage(cell *actorCell, env envelope) {

Callers 1

spawnWithPropsMethod · 0.95

Calls 2

cleanupActorMethod · 0.95
processMessageMethod · 0.95

Tested by

no test coverage detected