[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question about Common C++ 2 serial class
From: |
David Sugar |
Subject: |
Re: question about Common C++ 2 serial class |
Date: |
Wed, 16 Oct 2002 12:23:02 -0400 (EDT) |
I believe you should be able to use the isPending method to test if the
device is writable (isPending(SERIAL_PEND_OUTPUT, maxtime)) to safely test
if you can use this->flush with a timeout. flushOutput() is meant to
flush the device i/o queue and wait for i/o completion rather than the
stream buffer. The aRead and aWrite methods may also be overriden in a
derived class, and can be replaced with async i/o routines depending on
your environment.
David
On Wed, 16 Oct 2002, Tim Esselens wrote:
> Hi,
>
> I've been using your serial class for a HA (high availability) project. I've
> managed to get 2 machines to ping eachother over serial line. But there is a
> rather big problem coming up. If I flush (this->flush()) my object
> (SerialBeat: public TTYSession) the thread blocks, flushOutput() doesn't seem
> to be flushing at all.
>
> So, the problem I'm having is quite simple, how to flush in a nonblocking
> kind
> of mode, so after n msecs of 'unflushability' it could start throwing errors.
> I only hope the answer is as easy as the question.
>
> If this is not possible for some reason, is there a way around this (still
> using your serial class ofcourse)? I need to detect the other side is down,
> that's really it (maybe something the serial protocol allready includes, but
> I'm new to serial lines, so I wouldn't know).
>
> kind regards,
> Tim Esselens
>
> ps: NEWS stated sending questions to dyfet, README to bug-commoncpp, I did
> both <g>
>