threads


HOME

threads

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
NOTES
PORTABILITY
SEE ALSO

NAME

use_screen, use_windowcurses thread support

SYNOPSIS

#include <ncurses/curses.h>

typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *);
typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);
int get_escdelay(void);
int set_escdelay(int size);
int set_tabsize(int size);
int use_screen(SCREEN *scr, NCURSES_SCREEN_CB func, void *data);
int use_window(WINDOW *win, NCURSES_WINDOW_CB func, void *data);

DESCRIPTION

This implementation can be configured to provide rudimentary support for multi-threaded applications. This makes a different set of libraries, e.g., libncursest since the binary interfaces are different.

Rather than modify the interfaces to pass a thread specifier to each function, it adds a few functions which can be used in any configuration which hide the mutex’s needed to prevent concurrent use of the global variables when configured for threading.

In addition to forcing access to members of the WINDOW structure to be via functions (see curs_opaque(3x)), it makes functions of the common global variables, e.g., COLORS, COLOR_PAIRS, COLS, ESCDELAY, LINES, TABSIZE curscr, newscr and ttytype. Those variables are maintained as read-only values, stored in the SCREEN structure.

Even this is not enough to make a thread-safe application using curses. A multi-threaded application would be expected to have threads updating separate windows (within the same device), or updating on separate screens (on different devices). Also, a few of the global variables are considered writable by some applications. The functions described here address these special situations.

The ESCDELAY and TABSIZE global variables are modified by some applications. To modify them in any configuration, use the set_escdelay or set_tabsize functions. Other global variables are not modifiable.

The get_escdelay function returns the value for ESCDELAY.

The use_window and use_screen functions provide coarse granularity mutexes for their respective WINDOW and SCREEN parameters, and call a user-supplied function, passing it a data parameter, and returning the value from the user-supplied function to the application.

USAGE
All of the ncurses library functions assume that the locale is not altered during operation. In addition, they use data which is maintained within a hierarchy of scopes.

global data, e.g., used in the low-level terminfo or termcap interfaces.

terminal data, e.g., associated with a call to set_curterm. The terminal data are initialized when screens are created.

screen data, e.g., associated with a call to newterm or initscr.

window data, e.g., associated with a call to newwin or subwin. Windows are associated with screens. Pads are not necessarily associated with a particular screen.

Most curses applications operate on one or more windows within a single screen.

reentrant, i.e., it uses only the data passed as parameters.

This table lists the scope of data used for each symbol in the ncurses library when it is configured to support threading:

RETURN VALUE

These functions all return TRUE or FALSE, except as noted.

NOTES

Both a macro and a function are provided for each name.

PORTABILITY

These routines are specific to ncurses. They were not supported on Version 7, BSD or System V implementations. It is recommended that any code depending on ncurses extensions be conditioned using NCURSES_VERSION.

SEE ALSO

ncurses(3NCURSES), opaque(3NCURSES), curses_variables(3NCURSES).




More Linux Commands

manpages/gnutls_session_set_ptr.3.html
gnutls_session_set_ptr(3) - API function - Linux man page...
This function will set (associate) the user given pointer ptr to the session structure. This is pointer can be accessed with gnutls_session_get_ptr(). REPORTING

manpages/gnutls_hex_encode.3.html
gnutls_hex_encode(3) - API function - Linux manual page.....
This function will convert the given data to printable data, using the hex encoding, as used in the PSK password files. RETURNS GNUTLS_E_SHORT_MEMORY_BUFFER if

manpages/pthread_create.3.html
pthread_create(3) - create a new thread - Linux manual page
The pthread_create() function starts a new thread in the calling process. The new thread starts execution by invoking start_routine(); arg is passed as the sole

manpages/git-cherry-pick.1.html
git-cherry-pick(1) - Apply the changes introduced by some ex
Given one or more existing commits, apply the change each one introduces, recording a new commit for each. This requires your working tree to be clean (no modif

manpages/xdr_bool.3.html
xdr_bool(3) - library routines for external data representat
These routines allow C programmers to describe arbitrary data structures in a machine-independent fashion. Data for remote procedure calls are transmitted using

manpages/mrtglib.1.html
mrtglib(1) Library for MRTG and support scripts (Man Page)
MRTG_lib is part of MRTG , the Multi Router Traffic Grapher. It was separated from MRTG to allow other programs to easily use the same config files. The main pa

manpages/mcs.1.html
mcs(1) - Mono C# Compiler (1.0, 2.0, Moonlight) (Man Page)
mcs is the Mono C# compiler, an implementation of the ECMA-334 language specification. You can pass one or more options to drive the compiler, and a set of sour

manpages/startpar.8.html
startpar(8) - start runlevel scripts in parallel (Man Page)
startpar is used to run multiple run-level scripts in parallel. The degree of parallelism on one CPU can be set with the -p option, the default is full parallel

manpages/msgattrib.1.html
msgattrib(1) - attribute matching and manipulation on messag
Filters the messages of a translation catalog according to their attributes, and manipulates the attributes. Mandatory arguments to long options are mandatory f

manpages/fts.3.html
fts(3) - traverse a file hierarchy - Linux manual page......
The fts functions are provided for traversing file hierarchies. A simple overview is that the fts_open() function returns a handle on a file hierarchy, which is

manpages/bounce.8.html
bounce(8) - Postfix delivery status reports - Linux man page
The bounce(8) daemon maintains per-message log files with delivery status information. Each log file is named after the queue file that it corresponds to, and i

manpages/XtGrabPointer.3.html
XtGrabPointer(3) - manage grabs (Library - Linux man page)
XtGrabKey calls XGrabKey specifying the widgets window as the grab window if the widget is realized. The remaining arguments are exactly as for XGrabKey. If the





We can't live, work or learn in freedom unless the software we use is free.