ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Spectre2/Daemon.hpp
Revision: 406
Committed: 2004-12-30T22:08:35-08:00 (20 years, 5 months ago) by douglas
File size: 600 byte(s)
Log Message:
Damnit!

File Contents

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

Properties

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