This commit is contained in:
Suraxius committed 2021-01-31 15:15:28 +01:00
1 parent efb9eff3b1
commit f45201aa45
3 files changed
+23 -1

No files matched your search

+12 -1
View File
@@ -4,11 +4,22 @@
namespace Plains {
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() {
logger_.debug << "Testing from within EventBus!" << Logger::commit;
}
void EventBus::run() {
logger_.debug.ln("Hi from EventBus run method! From within Event Thread!");
}
}}
+7
View File
@@ -1,18 +1,25 @@
#ifndef EVENT_BUS_HPP
#define EVENT_BUS_HPP
#include "Logger.hpp"
#include <thread>
namespace Plains {
namespace Core {
using std::thread;
class EventBus {
private:
Logger& logger_;
//thread* thread_;
thread thread_;
public:
EventBus(Logger& logger);
~EventBus();
void test();
void run();
};
}}
+4
View File
@@ -28,6 +28,10 @@ int main(int args, char **argv) {
logger.debug.ln ("Running DNS resolver...");
resolver.run();
logger.info.ln ("PlaiNS successfully started.");
// Run something on main thread...
logger.info.ln ("Done - shutting down. Bye!");
}
catch (std::exception& e)
{