summaryrefslogtreecommitdiffabout
path: root/include/sitecing/process_manager.h
authorMichael Krelin <hacker@klever.net>2005-01-29 21:21:05 (UTC)
committer Michael Krelin <hacker@klever.net>2005-01-29 21:21:05 (UTC)
commitce1f37aae46ea95020d7b865f7a80e8abdfad0d8 (patch) (side-by-side diff)
tree4964383ab8cd7e6d8ea821f1a615d1bbcf98dad8 /include/sitecing/process_manager.h
parent3c75c860fc1ad5b3f5185e23ec6f438dd2528958 (diff)
downloadsitecing-ce1f37aae46ea95020d7b865f7a80e8abdfad0d8.zip
sitecing-ce1f37aae46ea95020d7b865f7a80e8abdfad0d8.tar.gz
sitecing-ce1f37aae46ea95020d7b865f7a80e8abdfad0d8.tar.bz2
initial commit into repository0.0
Diffstat (limited to 'include/sitecing/process_manager.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/sitecing/process_manager.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/include/sitecing/process_manager.h b/include/sitecing/process_manager.h
new file mode 100644
index 0000000..73415d3
--- a/dev/null
+++ b/include/sitecing/process_manager.h
@@ -0,0 +1,89 @@
+#ifndef __SITECING_PROCESS_MANAGER_H
+#define __SITECING_PROCESS_MANAGER_H
+
+#include <sitecing/scoreboard.h>
+
+/**
+ * @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 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 */