NimbRo ROS Soccer Package
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
read_thread.h
1
// Thread for reading data from the serial connection
2
// Author: Max Schwarz <max.schwarz@uni-bonn.de>
3
4
#ifndef READ_THREAD_H
5
#define READ_THREAD_H
6
7
#include <pthread.h>
8
#include <stdint.h>
9
10
#include <boost/circular_buffer.hpp>
11
12
namespace
io
13
{
14
15
class
ReadThread
16
{
17
public
:
18
ReadThread();
19
~ReadThread();
20
21
void
setFile(
int
fd);
22
23
void
run();
24
25
// User interface
26
int
read(uint8_t* data,
size_t
size,
struct
timespec* abstime);
27
void
flush();
28
29
static
void
* start(
void
* ptr);
30
private
:
31
int
m_fd;
32
33
uint8_t* m_buf;
34
volatile
size_t
m_writeIdx;
// byte to be written
35
volatile
size_t
m_readIdx;
// byte to be read in the next read()
36
37
pthread_mutex_t m_mutex;
38
pthread_cond_t m_cond;
39
};
40
41
}
42
43
#endif
hardware
cm730
include
cm730
read_thread.h
Generated on Thu Oct 20 2016 17:56:44 for NimbRo ROS Soccer Package by
1.8.6