#ifndef __SITECING_PROCESS_MANAGER_H #define __SITECING_PROCESS_MANAGER_H #include /** * @file * @brief the process manager. */ namespace sitecing { /** * The process manager. */ class process_manager { public: /** * Minimum number of child processes. */ int min_children; /** * Maxinum number of child processes. */ int max_children; /** * Minimum number of spare child processes. */ int min_spare_children; /** * Maxiumum number of spare child processes. */ int max_spare_children; /** * The scoreboard. */ scoreboard sboard; /** * We're in the process of shutting down. */ bool finishing; /** * @todo TODO: wish I could rememer -- document me. */ bool die_humbly; process_manager(); virtual ~process_manager(); /** * The main loop. */ void manage(); /** * The worker function. * @param slot the slot allocated for the process. */ virtual void process(int slot) = 0; /** * @todo TODO: wish I could remember -- document me. */ void manage_children(); /** * @todo TODO: wish I could remember -- document me. */ bool spawn_children(); /** * @todo TODO: wish I could remember -- document me. */ bool kill_children(); /** * @todo TODO: wish I could remember -- document me. */ void spawn_child(); /** * @todo TODO: wish I could remember -- document me. */ void wait_for_children(bool hang=false); /** * @todo TODO: wish I could remember -- document me. */ void collect_dead_souls(bool actively=false); }; } #endif /* __SITECING_PROCESS_MANAGER_H */