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

NAME

6       use_screen, use_window - curses thread support
7

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

NOTES

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

PORTABILITY

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

SEE ALSO

549       curses(3X), curs_opaque(3X)
550
551
552
553                                                              curs_threads(3X)
Impressum