ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Spectre2/Daemon.hpp
Revision: 429
Committed: 2005-03-25T18:47:25-08:00 (20 years, 2 months ago) by douglas
File size: 772 byte(s)
Log Message:
Refactorizeify! Brought to you by ideas in the shower and riding home in my brother's 4Runner.

File Contents

# Content
1 // Spectre 2
2 //
3 // Douglas Thrift
4 //
5 // $Id$
6
7 #ifndef _Daemon_hpp_
8 #define _Daemon_hpp_
9
10 #include "Share.hpp"
11
12 #ifndef MENES_PRAGMA_ONCE
13 #pragma once
14 #endif
15
16 #include <menes-api/threads.hpp>
17 #include <menes-etl/fnbind.hpp>
18 #include <menes-ext/threadset.hpp>
19
20 class Daemon
21 {
22 private:
23 #ifdef __FreeBSD__
24 static ext::String secret;
25 #endif
26 const api::Path& config;
27 ext::RedBlackSet<Share> shares;
28 bool running, loaded;
29 _H<api::Thread> thread;
30 int loop();
31 void load();
32 template <typename Worker>
33 int work();
34 public:
35 Daemon(const ext::String& config) : config(config), running(true), loaded(false), thread(new api::Thread(etl::BindAll(&Daemon::loop, this))) {}
36 ~Daemon();
37 void reload() { loaded = false; }
38 void stop() { running = false; }
39 };
40
41 #endif//_Daemon_hpp_

Properties

Name Value
svn:eol-style native
svn:keywords Id