GNU Octave
3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
libgui
qterminal
libqterminal
unix
SelfListener.cpp
Go to the documentation of this file.
1
/* qterminal - a terminal widget for Qt
2
* Copyright (C) 2011, 2013 Jacob Dawid (jacob.dawid@googlemail.com)
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation, either version 3 of the
7
* License, or (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#include "
unix/SelfListener.h
"
19
20
SelfListener::SelfListener
(
int
a,
QObject
*parent) :
21
QThread
(parent) {
22
_a
= a;
23
}
24
25
void
SelfListener::run
() {
26
char
buf[4096 + 1];
27
int
len;
28
bool
running =
true
;
29
while
(running) {
30
while
((len = ::read(
_a
, buf, 4096)) > 0) {
31
buf[len] = 0;
// Just in case.
32
emit
recvData
(buf, len);
33
msleep(30);
34
}
35
if
(len < 0)
36
running =
false
;
37
}
38
}
Generated on Mon Dec 30 2013 03:04:20 for GNU Octave by
1.8.1.2