O'Reilly logo

Learn You Some Erlang for Great Good! by Fred Hebert

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 17. Who Supervises the Supervisors?

Supervisors are one of the most useful parts of OTP. We’ve encountered basic supervisors in Chapter 12 and Chapter 13, where they offered a way to keep our software going in case of errors by just restarting the faulty processes. This chapter introduces OTP’s take on supervisors, which is much better than ours.

In our earlier examples, our supervisors would start a worker process, link to it, and trap exit signals with process_flag(trap_exit,true) to know when the process died and restart it. This is fine when we want restarts, but it’s also pretty dumb. Imagine that you’re using the remote control to turn on the TV. If it doesn’t work the first time, you might try again once or twice, just in case you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required