ChorusOS 4.0 Hot Restart Programmer's Guide

4.5 Putting It All Together: the restartSpawn Example Program

A programming example, restartSpawn, illustrates many of the function calls covered in this chapter and previous chapters. The example is provided as a framework illustration of the restart mechanism and the use of persistent memory. Parts of the example could be used as the basis of a more complex user application that incorporates hot restart.

The restartSpawn example uses two restartable actors, a parent actor, HR_parent.r and a child, HR_child.r which is spawned by the parent. Both actors should be compiled as supervisor actors. The source code for the two actors is provided in Appendix B, Example Application Code. The example can be summarized as follows:

The message is printed independently of the number of times the parent actor crashes or the site is restarted.