[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
posix TCPStream, Thread
From: |
Attila Dani |
Subject: |
posix TCPStream, Thread |
Date: |
03 Oct 2001 10:09:51 +0100 |
Hi,
I tried the posix version of the CommonC++ under
a debian linux system (potato), and it seems I
have found two bugs (or maybe features just I used
it on a wrong way).
1. If I recive a sentence via a TCPStream and send
back an answer without reading the whole input then
I lose the rest of it. Is it a correct behavior?
I modified the tcp.cpp demo file. After you compile,
run and open a telnet session, it should send back
your sentence word by word. It does not, just the first
word! /I attached the code, try: telnet localhost 18070/
2. Thread class: If a thread finishes its task normaly (
goes throught Initial, Run, Final) and we still have
the thread object then the isRunning() method returns
true. This is not right because the thread has already
stopped. The isRunning() works by the private _tid
variable of the Thread class. Maybe the next simple
modification would help in the execHandler() function:
..
..
th->setCancel(THREAD_CANCEL_DISABLED);
if(!pthread_detach(th->_tid) && th->_parent)
th->_parent->Notify(th);
th->Final();
// !
th->_tid = 0; //just setting to 0 the _tid
// !
pthread_exit(NULL);
}
Sorry, if I did not understand something correctly.
Regards,
Attila Dani.
tcp.cpp
Description: Text Data
- posix TCPStream, Thread,
Attila Dani <=