[BRLTTY] how to use readKey on Windows

Thijs Koerselman thijskoerselman at gmail.com
Fri Nov 28 08:02:33 EST 2008


On Wed, Nov 26, 2008 at 11:58 PM, James Teh <jamie at jantrid.net> wrote:

> On 27/11/2008 4:30 AM, Thijs Koerselman wrote:
> > My plan was to spawn a
> > new thread from my main app. This thread then calls readKey() in an
> > infinite loop (as long as some flag is valid). The keys returned by
> > brlapi are buffered, and my main app is reading this buffer at fixed
> > intervals.
> This won't work. If you call readKey in another thread like this (at
> least on Windows), any other calls to BRLAPI (e.g. to write text to the
> display) will block. I *think* this is because you can't have two
> operations occurring simultaneously on the same bidirectional pipe. This
> does make some sense.
>
> The solution I used in NVDA was to set up a timer in my main thread to
> poll for keys. This also avoids the need to spawn another thread.
>

Hi James,

Thanks for the info. The reason I spawn my own thread is because my app is
actually a plugin to a host. One of the things which are a bit dodgy about
the host are its event scheduling mechanism. I'm used to doing this kind of
thing in my own thread, but thinking about it I guess I don't need it in
this case since it's not such time critical data. The scheduler will be
robust enough to poll the key input.

For now it seems to work fine though. I'll probably change it around when I
get the braille display back again, since I don't have it atm.

Cheers,
Thijs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mielke.cc/pipermail/brltty/attachments/20081128/6d87f578/attachment.html 


More information about the BRLTTY mailing list