wip
This commit is contained in:
1 parent
efb9eff3b1
commit
f45201aa45
3 files changed
+23
-1
No files matched your search
+12
-1
@@ -4,11 +4,22 @@
|
|||||||
namespace Plains {
|
namespace Plains {
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
EventBus::EventBus(Logger& logger) : logger_(logger) {};
|
EventBus::EventBus(Logger& logger) : logger_(logger), thread_(&EventBus::run, this) {
|
||||||
|
logger_.debug.ln("Hi from EventBus Constructor. Not Theaded");
|
||||||
|
}
|
||||||
|
|
||||||
|
EventBus::~EventBus() {
|
||||||
|
thread_.join();
|
||||||
|
}
|
||||||
|
|
||||||
void EventBus::test() {
|
void EventBus::test() {
|
||||||
logger_.debug << "Testing from within EventBus!" << Logger::commit;
|
logger_.debug << "Testing from within EventBus!" << Logger::commit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EventBus::run() {
|
||||||
|
logger_.debug.ln("Hi from EventBus run method! From within Event Thread!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}}
|
}}
|
||||||
@@ -1,18 +1,25 @@
|
|||||||
#ifndef EVENT_BUS_HPP
|
#ifndef EVENT_BUS_HPP
|
||||||
#define EVENT_BUS_HPP
|
#define EVENT_BUS_HPP
|
||||||
#include "Logger.hpp"
|
#include "Logger.hpp"
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
|
|
||||||
namespace Plains {
|
namespace Plains {
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
using std::thread;
|
||||||
|
|
||||||
class EventBus {
|
class EventBus {
|
||||||
private:
|
private:
|
||||||
Logger& logger_;
|
Logger& logger_;
|
||||||
|
//thread* thread_;
|
||||||
|
thread thread_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EventBus(Logger& logger);
|
EventBus(Logger& logger);
|
||||||
|
~EventBus();
|
||||||
void test();
|
void test();
|
||||||
|
void run();
|
||||||
};
|
};
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ int main(int args, char **argv) {
|
|||||||
logger.debug.ln ("Running DNS resolver...");
|
logger.debug.ln ("Running DNS resolver...");
|
||||||
resolver.run();
|
resolver.run();
|
||||||
logger.info.ln ("PlaiNS successfully started.");
|
logger.info.ln ("PlaiNS successfully started.");
|
||||||
|
// Run something on main thread...
|
||||||
|
logger.info.ln ("Done - shutting down. Bye!");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user