GlobalObjects
Lade ...
Suche ...
Keine Treffer
EuRepeatingThread.h
gehe zur Dokumentation dieser Datei
1#ifndef INC_EUREPEATINGTHREAD_H
2#define INC_EUREPEATINGTHREAD_H
3//-----------------------------------------------------------------------------
51//-----------------------------------------------------------------------------
52// includes
53#include "EuToolTypes.h"
54#include "EuCriticalSection.h"
55#include <thread>
56#include <condition_variable>
57#include <mutex>
58//-----------------------------------------------------------------------------
59/* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
60#ifdef _MSC_VER
61 #pragma warning( disable : 4251 )
62#endif
63//-----------------------------------------------------------------------------
64namespace eut
65{
66 //---------------------------------------------------------------------------
93 {
94 public:
95 //============== local enums
108 {
109
119 EuTHREAD_ERR_NO_THREAD = -10301,
129 EuTHREAD_ERR_THREAD_ALREADY_WORKING = -10302,
139 EuTHREAD_ERR_THREAD_BREAK_COUNT_LESS_THAN_ZERO = -10303,
149 EuTHREAD_ERR_UNKNOWN = -10400,
150 };
151 //-----------------------------------------------------------------------
152
153 //-----------------------------------------------------------------------
217 //-----------------------------------------------------------------------
227 enum ORDER
228 {
258 eEXIT
259 };
260 //-----------------------------------------------------------------------
261
262 private:
263 //============== Attribute
264 //-----------------------------------------------------------------------
275 //-----------------------------------------------------------------------
286 //-----------------------------------------------------------------------
296 std::thread * m_pThread;
297 //-----------------------------------------------------------------------
312 //-----------------------------------------------------------------------
323 std::mutex m_WaitMutex;
324 //-----------------------------------------------------------------------
335 std::condition_variable m_InputCondVar;
336 //-----------------------------------------------------------------------
347 std::mutex m_BreakMutex;
348 //-----------------------------------------------------------------------
359 std::condition_variable m_BreakCondVar;
360 //-----------------------------------------------------------------------
379 //-----------------------------------------------------------------------
414 //-----------------------------------------------------------------------
415
416 #ifdef _DEBUG
417 public:
418 //============== Attribute
419 //-----------------------------------------------------------------------
429 std::string m_strDebugInfo;
430 //-----------------------------------------------------------------------
431 #endif
432
433 public:
434 //============== ctors & dtor
435 //-----------------------------------------------------------------------
446 //-----------------------------------------------------------------------
461 //-----------------------------------------------------------------------
462
463 private:
464 //-----------------------------------------------------------------------
475 //-----------------------------------------------------------------------
476
477 protected:
478 //============== methods
479 //-----------------------------------------------------------------------
491 //-----------------------------------------------------------------------
503 void setStatus( STATUS eStatus );
504 //-----------------------------------------------------------------------
517 //-----------------------------------------------------------------------
529 void toOrder( ORDER eOrder );
530 //-----------------------------------------------------------------------
543 //-----------------------------------------------------------------------
555 virtual void work() = 0;
556 //-----------------------------------------------------------------------
557
558 public:
559 //============== methods
560 //-----------------------------------------------------------------------
578 virtual int start();
579 //-----------------------------------------------------------------------
594 virtual void cancel();
595 //-----------------------------------------------------------------------
608 //-----------------------------------------------------------------------
621 //-----------------------------------------------------------------------
635 //-----------------------------------------------------------------------
648 //-----------------------------------------------------------------------
661 //-----------------------------------------------------------------------
673 //-----------------------------------------------------------------------
692 virtual void takeABreak();
693 //-----------------------------------------------------------------------
703 virtual void finishBreak();
704 //-----------------------------------------------------------------------
724 //-----------------------------------------------------------------------
736 //-----------------------------------------------------------------------
737
738 private:
739 //============== operators
740 //-----------------------------------------------------------------------
750 RepeatingThread & operator= ( const RepeatingThread & );
751 //-----------------------------------------------------------------------
752 };
753 //---------------------------------------------------------------------------
754 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
755 #ifdef _MSC_VER
756 #pragma warning( default : 4251 )
757 #endif
758 //---------------------------------------------------------------------------
759} // namespace eut
760#endif
Header für CriticalSection
Für jede Bibliothek, hier 'EuTools' gibt es eine Typen-Datei.
#define __tool_export_dll
Definition EuToolTypes.h:77
Ist ein Mutex, welcher über sein Lock-Modus abgefragt werden kann. Siehe isLocked().
Definition EuCriticalSection.h:109
Basisklasse für einen Thread der seine Arbeit endlos bis zum Abbruch ausführt.
Definition EuRepeatingThread.h:93
RepeatingThread(const RepeatingThread &)
virtual void work()=0
virtual ~RepeatingThread()
std::string m_strDebugInfo
Definition EuRepeatingThread.h:429
EuTHREADERROR
Fehlerbereich = -10301 bis -10400
Definition EuRepeatingThread.h:108
void setStatus(STATUS eStatus)
ORDER m_eOrder
Definition EuRepeatingThread.h:285
std::thread * m_pThread
Definition EuRepeatingThread.h:296
std::condition_variable m_InputCondVar
Definition EuRepeatingThread.h:335
virtual void cancel()
virtual void finishBreak()
std::mutex m_BreakMutex
Definition EuRepeatingThread.h:347
int m_iDataReady
Definition EuRepeatingThread.h:413
ORDER
Definition EuRepeatingThread.h:228
@ eUNDEFINED
Definition EuRepeatingThread.h:238
@ eDO_WORK
Definition EuRepeatingThread.h:248
int m_iBreakCounter
Definition EuRepeatingThread.h:378
std::condition_variable m_BreakCondVar
Definition EuRepeatingThread.h:359
STATUS
Definition EuRepeatingThread.h:165
@ eAT_THE_START
Definition EuRepeatingThread.h:175
@ ePAUSING
Definition EuRepeatingThread.h:195
@ eENDING
Definition EuRepeatingThread.h:205
@ eWORKING
Definition EuRepeatingThread.h:185
RepeatingThread::STATUS status() const
virtual int start()
CriticalSection m_ExclusiveAccessSection
Definition EuRepeatingThread.h:311
STATUS m_eStatus
Definition EuRepeatingThread.h:274
void toOrder(ORDER eOrder)
bool isInExclusiveAccess() const
virtual void takeABreak()
std::mutex m_WaitMutex
Definition EuRepeatingThread.h:323
Definition IniFile.h:62