终止 goroutine
概要在 go 中,一个 goroutine 是无法直接强制中断 另一个 goroutine 的。但是可以 goroutine A 向 goroutine B 发送请求终止信息,goroutine B 收到终止信息后中断自己,从而达到控制 goroutine 终止的目的。
dragonboat 是一个 Raft 库,其中使用 stopper 对 终止 goroutine 进行了封装。本文会给出...
阅读全文…