ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Spectre2/Daemon.hpp
Revision: 432
Committed: 2005-03-27T01:56:29-08:00 (20 years, 2 months ago) by douglas
File size: 1107 byte(s)
Log Message:
It should almost do everything it's supposed to.

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 "Spectre2.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 Share;
21
22 class Daemon
23 {
24 private:
25 const api::Path& config;
26 bool running, loaded;
27 unsigned interval/*, count*/;
28 _H<api::Thread> thread;
29 int loop();
30 void load();
31 template <typename Worker>
32 int work();
33 template <typename Worker>
34 int work_(const Share& share);
35 void sleep();
36 public:
37 Daemon(const api::Path& config) : config(config), running(true), loaded(false), interval(60), /*count(0),*/ thread(new api::Thread(etl::BindAll(&Daemon::loop, this))) {}
38 ~Daemon();
39 static ext::RedBlackSet<Share> shares;
40 // static api::ThreadMutex smbcLock;
41 #ifdef __FreeBSD__
42 static ext::String secret;
43 static api::ThreadMutex secretLock;
44 #else
45 static ext::RedBlackMap<ext::String, ext::String> secrets;
46 static api::ThreadMutex secretsLock;
47 #endif
48 void reload() { loaded = false; }
49 void stop() { running = false; }
50 };
51
52 #endif//_Daemon_hpp_

Properties

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