What happens to child threads when their parent dies in GHC Haskell?

后端 未结 3 1930
被撕碎了的回忆
被撕碎了的回忆 2021-02-14 02:55

The documentation for forkIO says

GHC note: the new thread inherits the masked state of the parent (see mask).

The newly created thread has an exce         


        
3条回答
  •  清歌不尽
    2021-02-14 03:39

    In a standalone GHC program, only the main thread is required to terminate in order for the process to terminate. Thus all other forked threads will simply terminate at the same time as the main thread (the terminology for this kind of behaviour is "daemonic threads").

    https://hackage.haskell.org/package/base-4.7.0.0/docs/Control-Concurrent.html#g:12

提交回复
热议问题