aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/select.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2010-03-31 15:00:48 +0000
committerChristopher Faylor <me@cgf.cx>2010-03-31 15:00:48 +0000
commite446d6d0f46722c6303f7c0dfbde27009d35045a (patch)
treef338420cd4fa12671a0a89044ca71c2c312fb569 /winsup/cygwin/select.cc
parent2aec20905ec3c76c94feb45af5c2f6c329fbf5e4 (diff)
downloadnewlib-e446d6d0f46722c6303f7c0dfbde27009d35045a.zip
newlib-e446d6d0f46722c6303f7c0dfbde27009d35045a.tar.gz
newlib-e446d6d0f46722c6303f7c0dfbde27009d35045a.tar.bz2
* fhandler.h (fhandler_base_overlapped): Temporarily (?) make select_pipe_info
a friend until the fhandler_tty intertangling can be worked out. * select.cc (select_pipe_info::add_watch_handle): Don't inspect the overlapped event if we're not waiting for I/O. (fhandler_tty_common::select_*): Change to standard function. Don't do kludgy fhandler_pipe coercion.
Diffstat (limited to 'winsup/cygwin/select.cc')
-rw-r--r--winsup/cygwin/select.cc39
1 files changed, 35 insertions, 4 deletions
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index e1906cb..1a07e7b 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -597,7 +597,7 @@ select_pipe_info::~select_pipe_info ()
void
select_pipe_info::add_watch_handle (fhandler_pipe *fh)
{
- if (fh->get_overlapped () && fh->get_overlapped ()->hEvent)
+ if (fh->io_pending && fh->get_overlapped () && fh->get_overlapped ()->hEvent)
w4[n++] = fh->get_overlapped ()->hEvent;
}
@@ -906,19 +906,50 @@ fhandler_console::select_except (select_stuff *ss)
select_record *
fhandler_tty_common::select_read (select_stuff *ss)
{
- return ((fhandler_pipe *) this)->fhandler_pipe::select_read (ss);
+ if (!ss->device_specific_pipe
+ && (ss->device_specific_pipe = new select_pipe_info) == NULL)
+ return NULL;
+
+ select_record *s = ss->start.next;
+ s->startup = start_thread_pipe;
+ s->peek = peek_pipe;
+ s->verify = verify_ok;
+ s->cleanup = pipe_cleanup;
+ s->read_selected = true;
+ s->read_ready = false;
+ return s;
}
select_record *
fhandler_tty_common::select_write (select_stuff *ss)
{
- return ((fhandler_pipe *) this)->fhandler_pipe::select_write (ss);
+ if (!ss->device_specific_pipe
+ && (ss->device_specific_pipe = new select_pipe_info) == NULL)
+ return NULL;
+ select_record *s = ss->start.next;
+ s->startup = start_thread_pipe;
+ s->peek = peek_pipe;
+ s->verify = verify_ok;
+ s->cleanup = pipe_cleanup;
+ s->write_selected = true;
+ s->write_ready = false;
+ return s;
}
select_record *
fhandler_tty_common::select_except (select_stuff *ss)
{
- return ((fhandler_pipe *) this)->fhandler_pipe::select_except (ss);
+ if (!ss->device_specific_pipe
+ && (ss->device_specific_pipe = new select_pipe_info) == NULL)
+ return NULL;
+ select_record *s = ss->start.next;
+ s->startup = start_thread_pipe;
+ s->peek = peek_pipe;
+ s->verify = verify_ok;
+ s->cleanup = pipe_cleanup;
+ s->except_selected = true;
+ s->except_ready = false;
+ return s;
}
static int