GRUTinizer
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
include
StoppableThread.h
Go to the documentation of this file.
1
#ifndef _STOPPABLETHREAD_H_
2
#define _STOPPABLETHREAD_H_
3
4
#ifndef __CINT__
5
#include <atomic>
6
#include <condition_variable>
7
#include <thread>
8
#endif
9
10
#include <string>
11
12
#include "TObject.h"
13
14
class
StoppableThread
{
15
public
:
16
StoppableThread
();
17
virtual
~StoppableThread
();
18
19
void
Resume
();
20
void
Pause
();
21
void
Stop
();
22
bool
IsPaused
();
23
bool
IsRunning
();
24
void
Join
();
25
26
virtual
std::string
Status
() {
return
""
; }
27
28
protected
:
29
virtual
bool
Iteration
() = 0;
30
31
private
:
32
StoppableThread
(
const
StoppableThread
& other) { }
33
StoppableThread
&
operator=
(
const
StoppableThread
& other) { }
34
35
void
Loop
();
36
37
#ifndef __CINT__
38
std::thread
thread
;
39
std::atomic_bool
running
;
40
std::atomic_bool
force_stop
;
41
std::atomic_bool
paused
;
42
std::condition_variable
paused_wait
;
43
std::mutex
pause_mutex
;
44
#endif
45
46
ClassDef
(
StoppableThread
, 0);
47
};
48
49
50
#endif
/* _STOPPABLETHREAD_H_ */
Generated on Wed Nov 4 2015 17:27:53 for GRUTinizer by
1.8.1.2