CEBL
2.1
Main Page
Namespaces
Data Structures
Files
File List
Globals
model
TimeoutThread.hpp
Go to the documentation of this file.
1
/*
2
* CEBL : CSU EEG Brain-Computer Interface Lab
3
*
4
* Author: Jeshua Bratman - jeshuabratman@gmail.com
5
*
6
* This file is part of CEBL.
7
*
8
* CEBL is free software; you can redistribute it and/or modify it.
9
* We only ask that if you use our code that you cite the source in
10
* your project or publication.
11
*
12
* EEG Group (www.cs.colostate.edu/eeg)
13
* Department of Computer Science
14
* Colorado State University
15
*
16
*/
17
26
#include <boost/thread/thread.hpp>
27
#include <boost/thread/mutex.hpp>
28
29
30
#ifndef TIMEOUTTHREAD_H
31
#define TIMEOUTTHREAD_H
32
33
34
class
TimeoutThread
35
{
36
private
:
38
void
timeoutRunner();
40
friend
void
runTimeoutThread
(
TimeoutThread
*);
41
42
protected
:
44
boost::thread *
updater_thread
;
46
bool
is_started
;
48
bool
halt
;
50
bool
halted
;
52
boost::mutex
thread_lock
;
54
double
timeout_length
;
55
56
//OVERRIDE THESE
57
virtual
void
timeoutFunction
() = 0;
58
60
void
timeoutStart
();
61
63
void
haltAndJoin
();
64
66
void
sleep
(
double
stime);
67
public
:
68
TimeoutThread
();
69
virtual
~TimeoutThread
();
70
71
bool
isHalted
() {
return
halted
;};
72
bool
isStarted
() {
return
is_started
;}
74
double
getTimeoutLength
() {
return
timeout_length
; }
76
void
setTimeoutLength
(
double
l) {
timeout_length
= l; }
77
78
79
80
};
81
82
83
#endif
Generated by
1.8.1.1