Commit f6b00c14f5a2fe2b351d01b9a2ecba3c7792b9cb
- Diff rendering mode:
- inline
- side by side
core/ds485/businterfacehandler.cpp
(1 / 1)
|   | |||
| 43 | 43 | //================================================== BusInterfaceHandler | |
| 44 | 44 | ||
| 45 | 45 | BusInterfaceHandler::BusInterfaceHandler(DSS* _pDSS, ModelMaintenance& _apartment) | |
| 46 | : ThreadedSubsystem(_pDSS, "BusInterfaceHandler", "BusInterfaceHandler"), | ||
| 46 | : ThreadedSubsystem(_pDSS, "BusInterfaceHandler"), | ||
| 47 | 47 | m_ModelMaintenance(_apartment) | |
| 48 | 48 | {} | |
| 49 | 49 |
core/metering/fake_meter.cpp
(1 / 1)
|   | |||
| 35 | 35 | ||
| 36 | 36 | namespace dss { | |
| 37 | 37 | FakeMeter::FakeMeter(DSS* _pDSS) | |
| 38 | : ThreadedSubsystem(_pDSS, "FakeMeter", "FakeMeter") | ||
| 38 | : ThreadedSubsystem(_pDSS, "FakeMeter") | ||
| 39 | 39 | { | |
| 40 | 40 | m_Config.reset(new MeteringConfigChain(false, 1, "mW")); | |
| 41 | 41 | m_Config->setComment("Consumption in mW"); |
core/metering/metering.cpp
(1 / 1)
|   | |||
| 43 | 43 | //================================================== Metering | |
| 44 | 44 | ||
| 45 | 45 | Metering::Metering(DSS* _pDSS) | |
| 46 | : ThreadedSubsystem(_pDSS, "Metering", "Metering"), | ||
| 46 | : ThreadedSubsystem(_pDSS, "Metering"), | ||
| 47 | 47 | m_pMeteringBusInterface(NULL) | |
| 48 | 48 | { | |
| 49 | 49 | getDSS().getPropertySystem().setStringValue(getConfigPropertyBasePath() + "storageLocation", getDSS().getWebrootDirectory() + "metering/", true); |
core/model/modelmaintenance.cpp
(1 / 1)
|   | |||
| 49 | 49 | namespace dss { | |
| 50 | 50 | ||
| 51 | 51 | ModelMaintenance::ModelMaintenance(DSS* _pDSS) | |
| 52 | : ThreadedSubsystem(_pDSS, "Apartment", "Apartment"), | ||
| 52 | : ThreadedSubsystem(_pDSS, "Apartment"), | ||
| 53 | 53 | m_IsInitializing(true), | |
| 54 | 54 | m_pApartment(NULL), | |
| 55 | 55 | m_pMetering(NULL) |
core/subsystem.h
(1 / 1)
|   | |||
| 71 | 71 | ||
| 72 | 72 | class ThreadedSubsystem: public Subsystem, protected Thread { | |
| 73 | 73 | public: | |
| 74 | ThreadedSubsystem(DSS* _pDSS, const std::string& _name, const char* _threadName) : Subsystem(_pDSS, _name), Thread(_threadName) {} | ||
| 74 | ThreadedSubsystem(DSS* _pDSS, const std::string& _name) : Subsystem(_pDSS, _name), Thread(_name) {} | ||
| 75 | 75 | virtual void shutdown() { Thread::terminate(); } | |
| 76 | 76 | bool isRunning() { return Thread::isRunning(); } | |
| 77 | 77 | }; |
core/thread.h
(5 / 3)
|   | |||
| 29 | 29 | #include <windows.h> | |
| 30 | 30 | #endif | |
| 31 | 31 | ||
| 32 | #include <string> | ||
| 33 | |||
| 32 | 34 | namespace dss { | |
| 33 | 35 | ||
| 34 | 36 | /** Wrapper for pthread- and Windows threads | |
| … | … | ||
| 43 | 43 | #else | |
| 44 | 44 | HANDLE m_ThreadHandle; | |
| 45 | 45 | #endif | |
| 46 | const char* m_Name; | ||
| 46 | std::string m_Name; | ||
| 47 | 47 | bool m_FreeAtTermination; | |
| 48 | 48 | bool m_Running; | |
| 49 | 49 | protected: | |
| 50 | 50 | bool m_Terminated; | |
| 51 | 51 | public: | |
| 52 | 52 | /** Constructs a thread with the given name */ | |
| 53 | Thread(const char* _name = NULL); | ||
| 53 | Thread(std::string _name = ""); | ||
| 54 | 54 | ||
| 55 | 55 | virtual ~Thread(); | |
| 56 | 56 | ||
| … | … | ||
| 74 | 74 | bool isRunning() const { return m_Running; } | |
| 75 | 75 | ||
| 76 | 76 | /** Returns the name of the thread that got passed to the constructor */ | |
| 77 | const char* getThreadIdentifier() { return m_Name; } | ||
| 77 | std::string &getThreadIdentifier() { return m_Name; } | ||
| 78 | 78 | private: | |
| 79 | 79 | virtual void cleanup() {} | |
| 80 | 80 | }; // Thread |
unix/thread.cpp
(3 / 3)
|   | |||
| 41 | 41 | ||
| 42 | 42 | thObj->execute(); | |
| 43 | 43 | ||
| 44 | if(thObj->getThreadIdentifier() != NULL) { | ||
| 44 | if(!thObj->getThreadIdentifier().empty()) { | ||
| 45 | 45 | Logger::getInstance()->log(std::string("Destroying thread: ") + thObj->getThreadIdentifier()); | |
| 46 | 46 | } else { | |
| 47 | 47 | Logger::getInstance()->log("Destroying thread: (no name)"); | |
| … | … | ||
| 54 | 54 | } // threadStarterHelpFunc | |
| 55 | 55 | ||
| 56 | 56 | ||
| 57 | Thread::Thread(const char* _name ) | ||
| 57 | Thread::Thread(std::string _name ) | ||
| 58 | 58 | : m_ThreadHandle( 0 ), | |
| 59 | 59 | m_Name( _name ), | |
| 60 | 60 | m_FreeAtTermination( false ), | |
| … | … | ||
| 76 | 76 | bool Thread::run() { | |
| 77 | 77 | assert( !m_Running ); | |
| 78 | 78 | m_Running = true; | |
| 79 | if( m_Name != NULL ) { | ||
| 79 | if( !m_Name.empty() ) { | ||
| 80 | 80 | Logger::getInstance()->log(std::string("creating thread for \"") + m_Name + "\""); | |
| 81 | 81 | } | |
| 82 | 82 | #ifndef WIN32 |
webservices/webservices.cpp
(1 / 1)
|   | |||
| 34 | 34 | //================================================== WebServices | |
| 35 | 35 | ||
| 36 | 36 | WebServices::WebServices(DSS* _pDSS) | |
| 37 | : ThreadedSubsystem(_pDSS, "WebServices", "WebServices") | ||
| 37 | : ThreadedSubsystem(_pDSS, "WebServices") | ||
| 38 | 38 | { | |
| 39 | 39 | ||
| 40 | 40 | } // ctor |

