JackTrip
Main Page
Related Pages
Classes
Files
File List
File Members
src
TestRingBuffer.h
Go to the documentation of this file.
1
#ifndef __TESTRINGBUFFER__
2
#define __TESTRINGBUFFER__
3
4
#include "
RingBuffer.h
"
5
#include <QThread>
6
#include <iostream>
7
8
static
RingBuffer
rb(2,100);
9
10
class
TestRingBufferWrite
:
public
QThread
11
{
12
public
:
13
14
void
run
()
15
{
16
int8_t
* writeSlot;
17
writeSlot =
new
int8_t
[2];
18
writeSlot[0] = *
"a"
;
19
writeSlot[1] = *
"b"
;
20
while
(
true
) {
21
//std::cout << "writing BEFORE" << std::endl;
22
rb.
insertSlotBlocking
(writeSlot);
23
//std::cout << "writing AFTER" << std::endl;
24
}
25
}
26
27
};
28
29
30
class
TestRingBufferRead
:
public
QThread
31
{
32
public
:
33
34
void
run
()
35
{
36
int8_t
* readSlot;
37
readSlot =
new
int8_t
[2];
38
while
(
true
) {
39
//std::cout << "reading BEFORE" << std::endl;
40
rb.
readSlotBlocking
(readSlot);
41
//std::cout << "reading AFTER" << std::endl;
42
//std::cout << *(readSlot) << std::endl;
43
//std::cout << *(readSlot+1) << std::endl;
44
}
45
}
46
};
47
48
#endif
49