[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why getch blocked when I did type something?
From: |
Thomas Dickey |
Subject: |
Re: Why getch blocked when I did type something? |
Date: |
Tue, 16 Dec 2008 18:48:47 -0500 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Tue, Dec 16, 2008 at 02:42:33PM +0800, John Daker wrote:
> Hi,all
> I recently had a problem that my program hang while I type something.
> First I thought it is blocked in read() from the tty, but it happens
> after I use select and set O_NONBLOCK .
ncurses might be using select() to do timeouts - but assuming your
application's running all in the same thread, that shouldn't be
a conflict.
> And finally I realize that it is blocked in read() from getch() after
> I gdb attach the process:
...
> (gdb) bt
> #0 0x420cdb44 in read () from /lib/i686/libc.so.6
> #1 0x4006cb44 in __JCR_LIST__ () from /lib/i686/libpthread.so.0
I do see you're using pthread though.
> #2 0x4002db88 in kgetch () from /usr/lib/libncurses.so.5
> #3 0x4002d335 in _nc_wgetch () from /usr/lib/libncurses.so.5
> #4 0x4002d8b8 in wgetch () from /usr/lib/libncurses.so.5
> #5 0x0804ba67 in main (argc=3, argv=0xbffffa54) at sitas.c:754
> #6 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
> (gdb) q
>
> I do type something but the program hang there, does anybody know why?
> Or maybe a bug of ncurses?
without a sample program, it's hard to guess.
kgetch is trying to fill in the rest of the characters for a match
against the function keys, etc.
--
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net
signature.asc
Description: Digital signature