From: Ian Lance Taylor <ian@airs.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org
Subject: Re: RFA: Various Windows (mingw32) additions, mostly relating to select or serial ports
Date: Sun, 05 Feb 2006 00:01:00 -0000 [thread overview]
Message-ID: <m3irruy8qk.fsf@gossamer.airs.com> (raw)
In-Reply-To: <20060204145911.GC17011@nevyn.them.org>
Daniel Jacobowitz <drow@false.org> writes:
> > Why do you have to poll? You should be able to have a thread which
> > just sleeps on reading the pipe. When the thread reads something, it
> > can signal the main thread, passing it the character which it read.
>
> I am glad you asked. Oh, so glad. I can't read from the pipe, because
> I can't pass the data to the main thread.
>
> There's a dissimilarity between the console and pipe support, and the
> serial and socket support. I used the serial.c interface for both
> pairs, but the serial and socket devices are accessed exclusively from
> the serial interface. On the other hand, that interface is only used
> for managing TTY state (and now for select) for the other two. The
> pipe I was interested in supporting was on stdin, and that gets
> read from in all sorts of interesting places - like inside the
> bowels of readline. If I read a character from the pipe, it's going
> to get lost.
>
> Pity there's no ungetc equivalent under the read() layer.
Well, OK, let's try this. Create a new pipe. Create yet another new
thread which reads from the original pipe and writes to the new pipe.
Freopen the new pipe onto stdin. When the new thread writes to the
new pipe, it signals the event loop once, and then waits. When the
event loop gets the signal, it indicates that it is OK to read from
stdin, the new pipe. When you reenter the event loop, it signals the
new thread to tell it that it is interested in more data and more
signals.
Ian
next prev parent reply other threads:[~2006-02-05 0:01 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-03 22:05 Daniel Jacobowitz
2006-02-03 22:08 ` Daniel Jacobowitz
2006-02-04 12:43 ` Eli Zaretskii
2006-02-04 15:13 ` Daniel Jacobowitz
2006-02-04 6:28 ` Ian Lance Taylor
2006-02-04 10:30 ` Eli Zaretskii
2006-02-04 17:06 ` Ian Lance Taylor
2006-02-04 17:45 ` Eli Zaretskii
2006-02-04 15:00 ` Daniel Jacobowitz
2006-02-05 0:01 ` Ian Lance Taylor [this message]
2006-02-05 22:00 ` Daniel Jacobowitz
2006-02-06 3:27 ` Ian Lance Taylor
2006-02-06 4:03 ` Daniel Jacobowitz
2006-02-04 12:38 ` Eli Zaretskii
2006-02-04 15:11 ` Daniel Jacobowitz
2006-02-04 15:23 ` Eli Zaretskii
2006-02-04 15:30 ` Daniel Jacobowitz
2006-02-06 21:02 ` Daniel Jacobowitz
2006-02-06 23:02 ` Mark Kettenis
2006-02-06 23:17 ` Daniel Jacobowitz
2006-02-06 23:21 ` Christopher Faylor
2006-02-09 22:38 ` Daniel Jacobowitz
2006-02-10 7:53 ` Eli Zaretskii
2006-02-10 20:46 ` Mark Kettenis
2006-02-10 22:02 ` Daniel Jacobowitz
2006-02-07 4:41 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3irruy8qk.fsf@gossamer.airs.com \
--to=ian@airs.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox