GlobalObjects
Lade ...
Suche ...
Keine Treffer
EuRepeatingThread.h
gehe zur Dokumentation dieser Datei
1#ifndef INC_EUREPEATINGTHREAD_H
2#define INC_EUREPEATINGTHREAD_H
3//-----------------------------------------------------------------------------
36//-----------------------------------------------------------------------------
37// includes
38#include "EuToolTypes.h"
39#include "EuCriticalSection.h"
40#include <thread>
41#include <condition_variable>
42#include <mutex>
43//-----------------------------------------------------------------------------
44/* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
45#ifdef _MSC_VER
46 #pragma warning( disable : 4251 )
47#endif
48//-----------------------------------------------------------------------------
49namespace eut
50{
51 //---------------------------------------------------------------------------
78 {
79 public:
80 //============== local enums
93 {
94
104 EuTHREAD_ERR_NO_THREAD = -10301,
114 EuTHREAD_ERR_THREAD_ALREADY_WORKING = -10302,
124 EuTHREAD_ERR_THREAD_BREAK_COUNT_LESS_THAN_ZERO = -10303,
134 EuTHREAD_ERR_UNKNOWN = -10400,
135 };
136 //-----------------------------------------------------------------------
137
138 //-----------------------------------------------------------------------
202 //-----------------------------------------------------------------------
212 enum ORDER
213 {
243 eEXIT
244 };
245 //-----------------------------------------------------------------------
246
247 private:
248 //============== Attribute
249 //-----------------------------------------------------------------------
260 //-----------------------------------------------------------------------
271 //-----------------------------------------------------------------------
281 std::thread * m_pThread;
282 //-----------------------------------------------------------------------
297 //-----------------------------------------------------------------------
308 std::mutex m_WaitMutex;
309 //-----------------------------------------------------------------------
320 std::condition_variable m_InputCondVar;
321 //-----------------------------------------------------------------------
332 std::mutex m_BreakMutex;
333 //-----------------------------------------------------------------------
344 std::condition_variable m_BreakCondVar;
345 //-----------------------------------------------------------------------
364 //-----------------------------------------------------------------------
399 //-----------------------------------------------------------------------
400
401 #ifdef _DEBUG
402 public:
403 //============== Attribute
404 //-----------------------------------------------------------------------
414 std::string m_strDebugInfo;
415 //-----------------------------------------------------------------------
416 #endif
417
418 public:
419 //============== ctors & dtor
420 //-----------------------------------------------------------------------
431 //-----------------------------------------------------------------------
446 //-----------------------------------------------------------------------
447
448 private:
449 //-----------------------------------------------------------------------
460 //-----------------------------------------------------------------------
461
462 protected:
463 //============== methods
464 //-----------------------------------------------------------------------
476 //-----------------------------------------------------------------------
488 void setStatus( STATUS eStatus );
489 //-----------------------------------------------------------------------
502 //-----------------------------------------------------------------------
514 void toOrder( ORDER eOrder );
515 //-----------------------------------------------------------------------
528 //-----------------------------------------------------------------------
540 virtual void work() = 0;
541 //-----------------------------------------------------------------------
542
543 public:
544 //============== methods
545 //-----------------------------------------------------------------------
563 virtual int start();
564 //-----------------------------------------------------------------------
579 virtual void cancel();
580 //-----------------------------------------------------------------------
593 //-----------------------------------------------------------------------
606 //-----------------------------------------------------------------------
620 //-----------------------------------------------------------------------
633 //-----------------------------------------------------------------------
646 //-----------------------------------------------------------------------
658 //-----------------------------------------------------------------------
677 virtual void takeABreak();
678 //-----------------------------------------------------------------------
688 virtual void finishBreak();
689 //-----------------------------------------------------------------------
709 //-----------------------------------------------------------------------
721 //-----------------------------------------------------------------------
722
723 private:
724 //============== operators
725 //-----------------------------------------------------------------------
735 RepeatingThread & operator= ( const RepeatingThread & );
736 //-----------------------------------------------------------------------
737 };
738 //---------------------------------------------------------------------------
739 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
740 #ifdef _MSC_VER
741 #pragma warning( default : 4251 )
742 #endif
743 //---------------------------------------------------------------------------
744} // namespace eut
745#endif
Header für CriticalSection
Für jede Bibliothek, hier 'EuTools' gibt es eine Typen-Datei.
#define __tool_export_dll
Definition EuToolTypes.h:63
Ist ein Mutex, welcher über sein Lock-Modus abgefragt werden kann. Siehe isLocked().
Definition EuCriticalSection.h:94
Basisklasse für einen Thread der seine Arbeit endlos bis zum Abbruch ausführt.
Definition EuRepeatingThread.h:78
RepeatingThread(const RepeatingThread &)
virtual void work()=0
virtual ~RepeatingThread()
std::string m_strDebugInfo
Definition EuRepeatingThread.h:414
EuTHREADERROR
Fehlerbereich = -10301 bis -10400
Definition EuRepeatingThread.h:93
void setStatus(STATUS eStatus)
ORDER m_eOrder
Definition EuRepeatingThread.h:270
std::thread * m_pThread
Definition EuRepeatingThread.h:281
std::condition_variable m_InputCondVar
Definition EuRepeatingThread.h:320
virtual void cancel()
virtual void finishBreak()
std::mutex m_BreakMutex
Definition EuRepeatingThread.h:332
int m_iDataReady
Definition EuRepeatingThread.h:398
ORDER
Definition EuRepeatingThread.h:213
@ eUNDEFINED
Definition EuRepeatingThread.h:223
@ eDO_WORK
Definition EuRepeatingThread.h:233
int m_iBreakCounter
Definition EuRepeatingThread.h:363
std::condition_variable m_BreakCondVar
Definition EuRepeatingThread.h:344
STATUS
Definition EuRepeatingThread.h:150
@ eAT_THE_START
Definition EuRepeatingThread.h:160
@ ePAUSING
Definition EuRepeatingThread.h:180
@ eENDING
Definition EuRepeatingThread.h:190
@ eWORKING
Definition EuRepeatingThread.h:170
RepeatingThread::STATUS status() const
virtual int start()
CriticalSection m_ExclusiveAccessSection
Definition EuRepeatingThread.h:296
STATUS m_eStatus
Definition EuRepeatingThread.h:259
void toOrder(ORDER eOrder)
bool isInExclusiveAccess() const
virtual void takeABreak()
std::mutex m_WaitMutex
Definition EuRepeatingThread.h:308
Definition IniFile.h:47