bug-ncurses
[Top][All Lists]
Advanced

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

Re: Is def_prog_mode() thread-safe?


From: Thomas Dickey
Subject: Re: Is def_prog_mode() thread-safe?
Date: Tue, 17 Jul 2007 16:23:41 -0400 (EDT)

On Tue, 17 Jul 2007, Katarina Machalkova wrote:

Hola ncurses-hackers

I'd like have multithread support in my ncurses application. In other words,
one UI thread, that moves keyboard focus around, redraws windows and does
other boring stuff, and the other thread, that does all the calculations.

However, in some point, I need to temporarily leave ncurses mode and run
another application in the same terminal. For this purpose, I use
def_prog_mode() and endwin() call. To resume my app back, reset_prog_mode()
and refresh() are used

My q. is: does def_prog_mode() take care of suspending properly multiple
threads, or does my application need to take care of this thread magic
itself? And similarly, is reset_prog_mode() able to resume multiple threads?
Thanks

The latter - as the code currently exists, you'll have to wrap the functions. I've been (between bugs...) working on a configure option
which makes the global data easier to work with in this regard (the
--enable-reentrant option).  It's incomplete, but with the latest patches,
there's enough that the process should be apparent.

But even with that, there are some global variables which must be managed. For instance, reset_prog_mode uses cur_term and SP. It-would-be-nice if the library presented a different copy of those to each thread.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




reply via email to

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