* fhandler.h (fhandler_serial::ev): New class member.

* fhandler_serial.cc (fhandler_serial::raw_read): Use class member for event
status.
* select.cc (peek_serial): Ditto.
This commit is contained in:
Christopher Faylor 2001-12-11 00:24:46 +00:00
parent cf77faefc8
commit 40139114ea
4 changed files with 11 additions and 7 deletions

View File

@ -1,3 +1,10 @@
2001-12-10 Christopher Faylor <cgf@redhat.com>
* fhandler.h (fhandler_serial::ev): New class member.
* fhandler_serial.cc (fhandler_serial::raw_read): Use class member for
event status.
* select.cc (peek_serial): Ditto.
2001-12-07 Christopher Faylor <cgf@redhat.com> 2001-12-07 Christopher Faylor <cgf@redhat.com>
* path.cc (path_conv::check): Use full path name for determining * path.cc (path_conv::check): Use full path name for determining

View File

@ -582,6 +582,7 @@ class fhandler_serial: public fhandler_base
public: public:
int overlapped_armed; int overlapped_armed;
OVERLAPPED io_status; OVERLAPPED io_status;
DWORD ev;
/* Constructor */ /* Constructor */
fhandler_serial (int unit); fhandler_serial (int unit);

View File

@ -60,7 +60,6 @@ fhandler_serial::raw_read (void *ptr, size_t ulen)
for (n = 0, tot = 0; ulen; ulen -= n, ptr = (char *)ptr + n) for (n = 0, tot = 0; ulen; ulen -= n, ptr = (char *)ptr + n)
{ {
DWORD ev;
COMSTAT st; COMSTAT st;
DWORD inq = 1; DWORD inq = 1;
@ -374,7 +373,6 @@ fhandler_serial::tcflush (int queue)
(we stop after 1000 chars anyway) */ (we stop after 1000 chars anyway) */
for (int max = 1000; max > 0; max--) for (int max = 1000; max > 0; max--)
{ {
DWORD ev;
COMSTAT st; COMSTAT st;
if (!PurgeComm (get_handle (), PURGE_RXABORT | PURGE_RXCLEAR)) if (!PurgeComm (get_handle (), PURGE_RXABORT | PURGE_RXCLEAR))
break; break;

View File

@ -865,7 +865,6 @@ struct serialinf
static int static int
peek_serial (select_record *s, bool) peek_serial (select_record *s, bool)
{ {
DWORD ev;
COMSTAT st; COMSTAT st;
fhandler_serial *fh = (fhandler_serial *)s->fh; fhandler_serial *fh = (fhandler_serial *)s->fh;
@ -890,19 +889,18 @@ peek_serial (select_record *s, bool)
if (!fh->overlapped_armed) if (!fh->overlapped_armed)
{ {
DWORD ev;
COMSTAT st; COMSTAT st;
ResetEvent (fh->io_status.hEvent); ResetEvent (fh->io_status.hEvent);
if (!ClearCommError (h, &ev, &st)) if (!ClearCommError (h, &fh->ev, &st))
{ {
debug_printf ("ClearCommError"); debug_printf ("ClearCommError");
goto err; goto err;
} }
else if (st.cbInQue) else if (st.cbInQue)
return s->read_ready = true; return s->read_ready = true;
else if (WaitCommEvent (h, &ev, &fh->io_status)) else if (WaitCommEvent (h, &fh->ev, &fh->io_status))
return s->read_ready = true; return s->read_ready = true;
else if (GetLastError () == ERROR_IO_PENDING) else if (GetLastError () == ERROR_IO_PENDING)
fh->overlapped_armed = 1; fh->overlapped_armed = 1;
@ -923,7 +921,7 @@ peek_serial (select_record *s, bool)
switch (WaitForMultipleObjects (2, w4, FALSE, to)) switch (WaitForMultipleObjects (2, w4, FALSE, to))
{ {
case WAIT_OBJECT_0: case WAIT_OBJECT_0:
if (!ClearCommError (h, &ev, &st)) if (!ClearCommError (h, &fh->ev, &st))
{ {
debug_printf ("ClearCommError"); debug_printf ("ClearCommError");
goto err; goto err;