duanqiaoren9975 2019-03-21 04:50
浏览 407

如何知道goroutine是否仍然存在?

Is there a comparable function like java Thread.isAlive() for goroutine?

I am trying to spawn some goroutine that is meant to be long living threads, but I am afraid that goroutine can die mid process, is there a check that I can do in my main thread to see if goroutine is alive?

  • 写回答

4条回答 默认 最新

  • douqi1931 2019-03-21 04:58
    关注

    Is there a comparable function like java Thread.isAlive() for goroutine?

    No. You have to redesign your solution. Goroutines have no identity and cannot be accessed in any way.

    评论

报告相同问题?