Erlang and process_flag(trap_exit, true)

前端 未结 3 1812
说谎
说谎 2020-12-28 16:25

After watching the Pragmatic Studio screen casts on Erlang, the last video on Supervisors mentioned that in order for a supervisor to get a notification about one of its chi

3条回答
  •  天涯浪人
    2020-12-28 17:18

    Supervisors use links and trap exits so they can keep track of their children and restart them when necessary. Child processes do not have to trap exits to be properly managed by their supervisors, indeed they should only trap when they specifically need to know that some process to which they are linked dies and they don't want to crash themselves.

    The OTP behaviours are able to properly handle supervision if they are trapped or not trapped.

提交回复
热议问题