1curs_threads(3X)                                              curs_threads(3X)
2
3
4

NAME

6       curs_threads - curses thread support
7

SYNOPSIS

9       #include <curses.h>
10
11       typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *);
12       typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);
13       int get_escdelay(void);
14       int set_escdelay(int size);
15       int set_tabsize(int size);
16       int use_screen(SCREEN *scr, NCURSES_SCREEN_CB func, void *data);
17       int use_window(WINDOW *win, NCURSES_WINDOW_CB func, void *data);
18

DESCRIPTION

20       This  implementation  can  be configured to provide rudimentary support
21       for multi-threaded applications.  This makes a  different  set  of  li‐
22       braries, e.g., libncursest since the binary interfaces are different.
23
24       Rather  than  modify  the interfaces to pass a thread specifier to each
25       function, it adds a few functions which can be used in  any  configura‐
26       tion  which  hide  the  mutex's needed to prevent concurrent use of the
27       global variables when configured for threading.
28
29       In addition to forcing access to members of the WINDOW structure to  be
30       via  functions  (see curs_opaque(3X)), it makes functions of the common
31       global variables, e.g., COLORS,  COLOR_PAIRS,  COLS,  ESCDELAY,  LINES,
32       TABSIZE  curscr, newscr and ttytype.  Those variables are maintained as
33       read-only values, stored in the SCREEN structure.
34
35       Even this is not enough to make a thread-safe application using curses.
36       A multi-threaded application would be expected to have threads updating
37       separate windows (within the same  device),  or  updating  on  separate
38       screens  (on  different  devices).  Also, a few of the global variables
39       are considered writable by some applications.  The functions  described
40       here address these special situations.
41
42       The ESCDELAY and TABSIZE global variables are modified by some applica‐
43       tions.  To modify them in any configuration, use  the  set_escdelay  or
44       set_tabsize functions.  Other global variables are not modifiable.
45
46       The get_escdelay function returns the value for ESCDELAY.
47
48       The  use_window and use_screen functions provide coarse granularity mu‐
49       texes for their respective WINDOW and SCREEN parameters, and call a us‐
50       er-supplied  function,  passing  it a data parameter, and returning the
51       value from the user-supplied function to the application.
52
53   USAGE
54       All of the ncurses library functions assume that the locale is not  al‐
55       tered during operation.  In addition, they use data which is maintained
56       within a hierarchy of scopes.
57
58          ·   global data, e.g., used in the low-level terminfo or termcap in‐
59              terfaces.
60
61          ·   terminal data, e.g., associated with a call to set_curterm.  The
62              terminal data are initialized when screens are created.
63
64          ·   screen data, e.g., associated with a call to newterm or initscr.
65
66          ·   window data, e.g., associated with a call to newwin  or  subwin.
67              Windows  are  associated with screens.  Pads are not necessarily
68              associated with a particular screen.
69
70              Most curses applications operate on one or more windows within a
71              single screen.
72
73          ·   reentrant, i.e., it uses only the data passed as parameters.
74
75       This  table lists the scope of data used for each symbol in the ncurses
76       library when it is configured to support threading:
77
78            Symbol                  Scope
79            ─────────────────────────────────────────────────────────────
80            BC                      global
81            COLORS                  screen (readonly)
82            COLOR_PAIR              reentrant
83            COLOR_PAIRS             screen (readonly)
84            COLS                    screen (readonly)
85            ESCDELAY                screen (readonly, see set_escdelay)
86            LINES                   screen (readonly)
87            PAIR_NUMBER             reentrant
88            PC                      global
89            SP                      global
90            TABSIZE                 screen (readonly)
91            UP                      global
92            acs_map                 screen (readonly)
93            add_wch                 window (stdscr)
94            add_wchnstr             window (stdscr)
95            add_wchstr              window (stdscr)
96            addch                   window (stdscr)
97            addchnstr               window (stdscr)
98            addchstr                window (stdscr)
99            addnstr                 window (stdscr)
100            addnwstr                window (stdscr)
101            addstr                  window (stdscr)
102            addwstr                 window (stdscr)
103            assume_default_colors   screen
104            attr_get                window (stdscr)
105            attr_off                window (stdscr)
106            attr_on                 window (stdscr)
107            attr_set                window (stdscr)
108            attroff                 window (stdscr)
109            attron                  window (stdscr)
110            attrset                 window (stdscr)
111            baudrate                screen
112            beep                    screen
113            bkgd                    window (stdscr)
114            bkgdset                 window (stdscr)
115            bkgrnd                  window (stdscr)
116            bkgrndset               window (stdscr)
117            boolcodes               global (readonly)
118            boolfnames              global (readonly)
119            boolnames               global (readonly)
120            border                  window (stdscr)
121            border_set              window (stdscr)
122            box                     window (stdscr)
123            box_set                 window (stdscr)
124            can_change_color        terminal
125            cbreak                  screen
126            chgat                   window (stdscr)
127            clear                   window (stdscr)
128            clearok                 window
129            clrtobot                window (stdscr)
130            clrtoeol                window (stdscr)
131            color_content           screen
132            color_set               window (stdscr)
133            copywin                 window locks(source, target)
134
135            cur_term                terminal
136            curs_set                screen
137            curscr                  screen (readonly)
138            curses_version          global (readonly)
139            def_prog_mode           terminal
140            def_shell_mode          terminal
141            define_key              screen
142            del_curterm             screen
143            delay_output            screen
144            delch                   window (stdscr)
145            deleteln                window (stdscr)
146            delscreen               global locks(screenlist, screen)
147            delwin                  global locks(windowlist)
148            derwin                  screen
149            doupdate                screen
150            dupwin                  screen locks(window)
151            echo                    screen
152            echo_wchar              window (stdscr)
153            echochar                window (stdscr)
154            endwin                  screen
155            erase                   window (stdscr)
156            erasechar               window (stdscr)
157            erasewchar              window (stdscr)
158            filter                  global
159            flash                   terminal
160            flushinp                screen
161            get_wch                 screen (input-operation)
162            get_wstr                screen (input-operation)
163            getattrs                window
164            getbegx                 window
165            getbegy                 window
166            getbkgd                 window
167            getbkgrnd               window
168            getcchar                reentrant
169            getch                   screen (input-operation)
170            getcurx                 window
171            getcury                 window
172            getmaxx                 window
173            getmaxy                 window
174            getmouse                screen (input-operation)
175            getn_wstr               screen (input-operation)
176            getnstr                 screen (input-operation)
177            getparx                 window
178            getpary                 window
179            getstr                  screen (input-operation)
180            getwin                  screen (input-operation)
181            halfdelay               screen
182            has_colors              terminal
183            has_ic                  terminal
184            has_il                  terminal
185            has_key                 screen
186            hline                   window (stdscr)
187            hline_set               window (stdscr)
188            idcok                   window
189            idlok                   window
190            immedok                 window
191            in_wch                  window (stdscr)
192            in_wchnstr              window (stdscr)
193            in_wchstr               window (stdscr)
194            inch                    window (stdscr)
195            inchnstr                window (stdscr)
196            inchstr                 window (stdscr)
197            init_color              screen
198            init_pair               screen
199            initscr                 global locks(screenlist)
200            innstr                  window (stdscr)
201
202            innwstr                 window (stdscr)
203            ins_nwstr               window (stdscr)
204            ins_wch                 window (stdscr)
205            ins_wstr                window (stdscr)
206            insch                   window (stdscr)
207            insdelln                window (stdscr)
208            insertln                window (stdscr)
209            insnstr                 window (stdscr)
210            insstr                  window (stdscr)
211            instr                   window (stdscr)
212            intrflush               terminal
213            inwstr                  window (stdscr)
214            is_cleared              window
215            is_idcok                window
216            is_idlok                window
217            is_immedok              window
218            is_keypad               window
219            is_leaveok              window
220            is_linetouched          window
221            is_nodelay              window
222            is_notimeout            window
223            is_scrollok             window
224            is_syncok               window
225            is_term_resized         terminal
226            is_wintouched           window
227            isendwin                screen
228            key_defined             screen
229            key_name                global (static data)
230            keybound                screen
231            keyname                 global (static data)
232            keyok                   screen
233            keypad                  window
234            killchar                terminal
235            killwchar               terminal
236            leaveok                 window
237            longname                screen
238            mcprint                 terminal
239            meta                    screen
240            mouse_trafo             window (stdscr)
241            mouseinterval           screen
242            mousemask               screen
243            move                    window (stdscr)
244            mvadd_wch               window (stdscr)
245            mvadd_wchnstr           window (stdscr)
246            mvadd_wchstr            window (stdscr)
247            mvaddch                 window (stdscr)
248            mvaddchnstr             window (stdscr)
249            mvaddchstr              window (stdscr)
250            mvaddnstr               window (stdscr)
251            mvaddnwstr              window (stdscr)
252            mvaddstr                window (stdscr)
253            mvaddwstr               window (stdscr)
254            mvchgat                 window (stdscr)
255            mvcur                   screen
256            mvdelch                 window (stdscr)
257            mvderwin                window (stdscr)
258            mvget_wch               screen (input-operation)
259            mvget_wstr              screen (input-operation)
260            mvgetch                 screen (input-operation)
261            mvgetn_wstr             screen (input-operation)
262            mvgetnstr               screen (input-operation)
263            mvgetstr                screen (input-operation)
264            mvhline                 window (stdscr)
265            mvhline_set             window (stdscr)
266            mvin_wch                window (stdscr)
267            mvin_wchnstr            window (stdscr)
268
269            mvin_wchstr             window (stdscr)
270            mvinch                  window (stdscr)
271            mvinchnstr              window (stdscr)
272            mvinchstr               window (stdscr)
273            mvinnstr                window (stdscr)
274            mvinnwstr               window (stdscr)
275            mvins_nwstr             window (stdscr)
276            mvins_wch               window (stdscr)
277            mvins_wstr              window (stdscr)
278            mvinsch                 window (stdscr)
279            mvinsnstr               window (stdscr)
280            mvinsstr                window (stdscr)
281            mvinstr                 window (stdscr)
282            mvinwstr                window (stdscr)
283            mvprintw                window (stdscr)
284            mvscanw                 screen
285            mvvline                 window (stdscr)
286            mvvline_set             window (stdscr)
287            mvwadd_wch              window
288            mvwadd_wchnstr          window
289            mvwadd_wchstr           window
290            mvwaddch                window
291            mvwaddchnstr            window
292            mvwaddchstr             window
293            mvwaddnstr              window
294            mvwaddnwstr             window
295            mvwaddstr               window
296            mvwaddwstr              window
297            mvwchgat                window
298            mvwdelch                window
299            mvwget_wch              screen (input-operation)
300            mvwget_wstr             screen (input-operation)
301            mvwgetch                screen (input-operation)
302            mvwgetn_wstr            screen (input-operation)
303            mvwgetnstr              screen (input-operation)
304            mvwgetstr               screen (input-operation)
305            mvwhline                window
306            mvwhline_set            window
307            mvwin                   window
308            mvwin_wch               window
309            mvwin_wchnstr           window
310            mvwin_wchstr            window
311            mvwinch                 window
312            mvwinchnstr             window
313            mvwinchstr              window
314            mvwinnstr               window
315            mvwinnwstr              window
316            mvwins_nwstr            window
317            mvwins_wch              window
318            mvwins_wstr             window
319            mvwinsch                window
320            mvwinsnstr              window
321            mvwinsstr               window
322            mvwinstr                window
323            mvwinwstr               window
324            mvwprintw               window
325            mvwscanw                screen
326            mvwvline                window
327            mvwvline_set            window
328            napms                   reentrant
329            newpad                  global locks(windowlist)
330            newscr                  screen (readonly)
331            newterm                 global locks(screenlist)
332            newwin                  global locks(windowlist)
333            nl                      screen
334            nocbreak                screen
335
336            nodelay                 window
337            noecho                  screen
338            nofilter                global
339            nonl                    screen
340            noqiflush               terminal
341            noraw                   screen
342            notimeout               window
343            numcodes                global (readonly)
344            numfnames               global (readonly)
345            numnames                global (readonly)
346            ospeed                  global
347            overlay                 window locks(source, target)
348            overwrite               window locks(source, target)
349            pair_content            screen
350            pecho_wchar             screen
351            pechochar               screen
352            pnoutrefresh            screen
353            prefresh                screen
354            printw                  window
355            putp                    global
356            putwin                  window
357            qiflush                 terminal
358            raw                     screen
359            redrawwin               window
360            refresh                 screen
361            reset_prog_mode         screen
362            reset_shell_mode        screen
363            resetty                 terminal
364            resize_term             screen locks(windowlist)
365            resizeterm              screen
366            restartterm             screen
367            ripoffline              global (static data)
368            savetty                 terminal
369            scanw                   screen
370            scr_dump                screen
371            scr_init                screen
372            scr_restore             screen
373            scr_set                 screen
374            scrl                    window (stdscr)
375            scroll                  window
376            scrollok                window
377            set_curterm             screen
378            set_escdelay            screen
379            set_tabsize             screen
380            set_term                global locks(screenlist, screen)
381            setcchar                reentrant
382            setscrreg               window (stdscr)
383            setupterm               global
384            slk_attr                screen
385            slk_attr_off            screen
386            slk_attr_on             screen
387            slk_attr_set            screen
388            slk_attroff             screen
389            slk_attron              screen
390            slk_attrset             screen
391            slk_clear               screen
392            slk_color               screen
393            slk_init                screen
394            slk_label               screen
395            slk_noutrefresh         screen
396            slk_refresh             screen
397            slk_restore             screen
398            slk_set                 screen
399            slk_touch               screen
400            slk_wset                screen
401            standend                window
402
403            standout                window
404            start_color             screen
405            stdscr                  screen (readonly)
406            strcodes                global (readonly)
407            strfnames               global (readonly)
408            strnames                global (readonly)
409            subpad                  window
410            subwin                  window
411            syncok                  window
412            term_attrs              screen
413            termattrs               screen
414            termname                terminal
415            tgetent                 global
416            tgetflag                global
417            tgetnum                 global
418            tgetstr                 global
419            tgoto                   global
420            tigetflag               terminal
421            tigetnum                terminal
422            tigetstr                terminal
423            timeout                 window (stdscr)
424            touchline               window
425            touchwin                window
426            tparm                   global (static data)
427            tputs                   screen
428            trace                   global (static data)
429            ttytype                 screen (readonly)
430            typeahead               screen
431            unctrl                  screen
432            unget_wch               screen (input-operation)
433            ungetch                 screen (input-operation)
434            ungetmouse              screen (input-operation)
435            untouchwin              window
436            use_default_colors      screen
437            use_env                 global (static data)
438            use_extended_names      global (static data)
439            use_legacy_coding       screen
440            use_screen              global locks(screenlist, screen)
441            use_window              global locks(windowlist, window)
442            vid_attr                screen
443            vid_puts                screen
444            vidattr                 screen
445            vidputs                 screen
446            vline                   window (stdscr)
447            vline_set               window (stdscr)
448            vw_printw               window
449            vw_scanw                screen
450            vwprintw                window
451            vwscanw                 screen
452            wadd_wch                window
453            wadd_wchnstr            window
454            wadd_wchstr             window
455            waddch                  window
456            waddchnstr              window
457            waddchstr               window
458            waddnstr                window
459            waddnwstr               window
460            waddstr                 window
461            waddwstr                window
462            wattr_get               window
463            wattr_off               window
464            wattr_on                window
465            wattr_set               window
466            wattroff                window
467            wattron                 window
468            wattrset                window
469
470            wbkgd                   window
471            wbkgdset                window
472            wbkgrnd                 window
473            wbkgrndset              window
474            wborder                 window
475            wborder_set             window
476            wchgat                  window
477            wclear                  window
478            wclrtobot               window
479            wclrtoeol               window
480            wcolor_set              window
481            wcursyncup              screen (affects window plus parents)
482            wdelch                  window
483            wdeleteln               window
484            wecho_wchar             window
485            wechochar               window
486            wenclose                window
487            werase                  window
488            wget_wch                screen (input-operation)
489            wget_wstr               screen (input-operation)
490            wgetbkgrnd              window
491            wgetch                  screen (input-operation)
492            wgetdelay               window
493            wgetn_wstr              screen (input-operation)
494            wgetnstr                screen (input-operation)
495            wgetparent              window
496            wgetscrreg              window
497            wgetstr                 screen (input-operation)
498            whline                  window
499            whline_set              window
500            win_wch                 window
501            win_wchnstr             window
502            win_wchstr              window
503            winch                   window
504            winchnstr               window
505            winchstr                window
506            winnstr                 window
507            winnwstr                window
508            wins_nwstr              window
509            wins_wch                window
510            wins_wstr               window
511            winsch                  window
512            winsdelln               window
513            winsertln               window
514            winsnstr                window
515            winsstr                 window
516            winstr                  window
517            winwstr                 window
518            wmouse_trafo            window
519            wmove                   window
520            wnoutrefresh            screen
521            wprintw                 window
522            wredrawln               window
523            wrefresh                screen
524            wresize                 window locks(windowlist)
525            wscanw                  screen
526            wscrl                   window
527            wsetscrreg              window
528            wstandend               window
529            wstandout               window
530            wsyncdown               screen (affects window plus parents)
531            wsyncup                 screen (affects window plus parents)
532            wtimeout                window
533            wtouchln                window
534            wunctrl                 global (static data)
535            wvline                  window
536
537            wvline_set              window
538

RETURN VALUE

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

NOTES

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

PORTABILITY

546       These routines are specific to ncurses.  They  were  not  supported  on
547       Version 7, BSD or System V implementations.  It is recommended that any
548       code depending on ncurses extensions be conditioned using  NCURSES_VER‐
549       SION.
550

SEE ALSO

552       curses(3X), curs_opaque(3X), curs_variables(3X).
553
554
555
556                                                              curs_threads(3X)
Impressum