[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: ncurses, pthreads, and serial port
From: |
Troy Davis |
Subject: |
RE: ncurses, pthreads, and serial port |
Date: |
Thu, 30 May 2002 10:14:28 -0500 |
Ah-
That answers that question. Now I have a new problem. When I call
open("/dev/ttys0", O_RDWR | O_NOCTTY | O_NONBLOCK) I get screen corruption -
my left menu is partially overwritten by what I use as a background color
(blue), and the scroll functions no longer work. I have tracked it down to
this specific call that does it. Of course, I was doing this call in a
thread before which did not result in screen corruption but resulted in odd
behavior of the serial output window. Any ideas anyone?
Troy Davis
Engineer
Airborne Data Systems, Inc.
> -----Original Message-----
> From: address@hidden [mailto:address@hidden
> Behalf Of Thomas Dickey
> Sent: Wednesday, May 29, 2002 8:02 PM
> To: Troy Davis
> Cc: address@hidden
> Subject: Re: ncurses, pthreads, and serial port
>
>
> On Wed, May 29, 2002 at 05:15:59PM -0500, Troy Davis wrote:
>
> > I start by doing initscr(), init_colors(), noecho(),
> cbreak(), clear(). I
> > set up the main window (stdscr). I then create a new window as
> a menu. I
> > make simple list, put it on screen, with a very simple scroll handler to
> > arrow through the list. Then I create a 3rd window (upon the
> appropriate
> > menu choice) using newwin. I then call pthread_create. This creates a
> > thread that initializes a serial port, and then arrives at a
> while(1) loop.
> > The while loop does a read of the serial port (non-blocking) and upon a
> > return of 1 (a single character), does a waddch() to the
> appropriate window
> > followed by a wrefresh().
>
> ncurses isn't thread-safe, so you can only use it like that if there's
> only one thread that calls ncurses.
>
> --
> Thomas E. Dickey <address@hidden>
> http://invisible-island.net
> ftp://invisible-island.net
>
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-ncurses
>