[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Questions: void SerialEcho::run()
From: |
Conrad T. Pino |
Subject: |
Questions: void SerialEcho::run() |
Date: |
Mon, 29 Aug 2005 22:02:00 -0700 |
void SerialEcho::run() {
char* s = new char[getBufferSize()];
cout << "start monitor" << endl;
while (s[0] != 'X') {
while (isPending(Serial::pendingInput)) {
cout.put( TTYStream::get() );
}
sleep(500);
}
cout << "end of monitor" << endl;
delete [] s;
exit();
}
What's the point of "while (s[0] != 'X')" when
"s[0]" is never modified?
What's the point of polling "isPending" in a loop?
Doesn't that defeat the very purpose of threading?
What are reasons this implementation won't work:
void SerialEcho::run( ) {
cout << "start monitor" << endl;
int data;
while ( ( data = TTYStream::get( ) ) != 'X' ) {
cout.put( data );
}
cout << "end of monitor" << endl;
exit();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Questions: void SerialEcho::run(),
Conrad T. Pino <=