Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Static Public Member Functions | List of all members
net_instaweb::ControllerManager Class Reference

#include "controller_manager.h"

Static Public Member Functions

static void ForkControllerProcess (std::unique_ptr< ControllerProcess > &&process, SystemRewriteDriverFactory *factory, ThreadSystem *thread_system, MessageHandler *handler)
 
static void DetachFromControllerProcess ()
 

Detailed Description

Handles forking off a controller process, restarting it if it dies, and shutting down the process if the host reloads config or shuts down.

We fork a babysitter process, which forks a controller process. If the controller process dies without calling exit(0) the babysitter will fork off another controller.

The controller runs a thread that watches for the root process to die, or to ask it to quit. We use pipes for communication between the master process and the controller. If the master process goes away, the controller reading will get EOF. If the master process wants the controller to shut down so it can be replaced, it writes a byte.

(All methods in the ControllerManager are static. When you call ForkControllerProcess() it keeps running until process exit.)

Member Function Documentation

static void net_instaweb::ControllerManager::DetachFromControllerProcess ( )
static

Relinquishes the reference from us to the controller process. This may be needed if our current process is going to go on and do something unrelated.

static void net_instaweb::ControllerManager::ForkControllerProcess ( std::unique_ptr< ControllerProcess > &&  process,
SystemRewriteDriverFactory factory,
ThreadSystem thread_system,
MessageHandler handler 
)
static

Called on system startup, before forking off any workers. Starts up a babysitter process that starts a controller process and restarts the controller if it dies. Also called (again) on configuration reloading.


The documentation for this class was generated from the following file: