ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Spectre2/Daemon.hpp
(Generate patch)

Comparing Spectre2/Daemon.hpp (file contents):
Revision 407 by douglas, 2004-12-30T22:32:13-08:00 vs.
Revision 430 by douglas, 2005-03-25T19:01:08-08:00

# Line 15 | Line 15
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 + #ifdef __FreeBSD__
26 +        static ext::String secret;
27 + #endif
28 +        const api::Path& config;
29 +        bool running, loaded;
30          _H<api::Thread> thread;
31          int loop();
32 < protected:
33 <        bool running, loaded;
34 <        virtual void load() = 0;
27 <        virtual void run() = 0;
28 <        Daemon() : running(false), loaded(false) {}
32 >        void load();
33 >        template <typename Worker>
34 >                int work();
35   public:
36 <        virtual ~Daemon() { if (!thread.IsEmpty()) thread->Join(); }
37 <        void start();
38 <        void wait();
36 >        Daemon(const ext::String& config) : config(config), running(true), loaded(false), thread(new api::Thread(etl::BindAll(&Daemon::loop, this))) {}
37 >        ~Daemon();
38 >        static ext::RedBlackSet<Share> shares;
39          void reload() { loaded = false; }
40          void stop() { running = false; }
41   };
42  
43 < #endif // _Daemon_hpp_
43 > #endif//_Daemon_hpp_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines