ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Spectre2/Daemon.hpp
Revision: 428
Committed: 2005-03-24T17:38:00-08:00 (20 years, 2 months ago) by douglas
File size: 647 byte(s)
Log Message:
Finally, I can commit!

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 Daemon
21 {
22 private:
23 _H<api::Thread> thread;
24 int loop();
25 protected:
26 bool running, loaded;
27 virtual void load() = 0;
28 virtual void run() = 0;
29 Daemon() : running(false), loaded(false) {}
30 public:
31 virtual ~Daemon() { if (!thread.IsEmpty()) thread->Join(); }
32 void start();
33 void wait();
34 void reload() { loaded = false; }
35 void stop() { running = false; }
36 };
37
38 #endif//_Daemon_hpp_

Properties

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