view libqterminal/unix/SelfListener.cpp @ 15651:845cebf281aa

Added files of QConsole.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Mon, 30 Jan 2012 11:23:13 +0100
parents
children 35c891dce299
line wrap: on
line source

#include "SelfListener.h"

SelfListener::SelfListener(int a, QObject *parent) :
    QThread(parent) {
    _a = a;
}

void SelfListener::run() {
    char buf[1025];
    int len;

    while(1) {
        len = ::read(_a, buf, 1024);
        if (len > 0) {
           buf[len] = 0; // Just in case.
           emit recvData(buf, len);
        }
    }
}