[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: signals interrupting wgetch

From: Thomas Dickey
Subject: Re: signals interrupting wgetch
Date: Thu, 21 Jul 2005 21:08:03 -0400 (EDT)

On Thu, 21 Jul 2005, John Gruenenfelder wrote:

As long as the subject is up, are there any caveats I should know about when
using ncurses in a multithreaded program?  I don't recall seeing anything
specific in the documentation.

Well, since it uses global data (stdscr, newscr, curscr, and of course
the input FIFO), only one thread should do I/O.  wgetnstr() is an example
where the call does both input and output.

It "should" be possible to make waddch() threadsafe by putting a mutex on the WINDOW* so only one thread could write to a window at a time. But even with that, there are complications (a subwin() call returns data that's shared with the parent window for instance). Also, wrefresh() would have to be modified (since the global windows are updated there). I think it
would be interesting to see if those two (waddch and wrefresh) could be
modified to make some useful support for threading.

I don't think making wgetch() threadsafe would be very useful (though one
could certainly design an application to use that).

Thomas E. Dickey

reply via email to

[Prev in Thread] Current Thread [Next in Thread]