]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 5.6 - patch 20080223
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 24 Feb 2008 01:25:21 +0000 (01:25 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 24 Feb 2008 01:25:21 +0000 (01:25 +0000)
+ fix a size-difference in _nc_globals which caused hanging of mutex
  lock/unlock when termlib was built separately.
+ avoid using nanosleep() in threaded configuration since that often
  is implemented to suspend the entire process.

NEWS
dist.mk
man/terminfo.tail
ncurses/base/lib_newwin.c
ncurses/curses.priv.h
ncurses/tinfo/lib_data.c
test/demo_menus.c
test/hashtest.c
test/ncurses.c
test/test.priv.h
test/worm.c

diff --git a/NEWS b/NEWS
index d71eaf8a36c074558d8611ab4a8f54137d10db62..5634dbc392d4f409f2064fde6ad05c82efac8190 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1206 2008/02/09 23:49:39 tom Exp $
+-- $Id: NEWS,v 1.1208 2008/02/23 21:26:58 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,14 @@ See the AUTHORS file for the corresponding full names.
 Changes through 1.9.9e did not credit all contributions;
 it is not possible to add this information.
 
+20080223
+       + fix a size-difference in _nc_globals which caused hanging of mutex
+         lock/unlock when termlib was built separately.
+
+20080216
+       + avoid using nanosleep() in threaded configuration since that often
+         is implemented to suspend the entire process.
+
 20080209
        + update test programs to build/work with various UNIX curses for
          comparisons.  This was to reinvestigate statement in X/Open curses
diff --git a/dist.mk b/dist.mk
index 0141b05ee9f2c477b0a8aa29f545b8e51064431c..4bc5ab059f73f909457456f5c5a8f208075f3442 100644 (file)
--- a/dist.mk
+++ b/dist.mk
@@ -25,7 +25,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: dist.mk,v 1.629 2008/02/09 15:32:57 tom Exp $
+# $Id: dist.mk,v 1.631 2008/02/23 14:51:29 tom Exp $
 # Makefile for creating ncurses distributions.
 #
 # This only needs to be used directly as a makefile by developers, but
@@ -37,7 +37,7 @@ SHELL = /bin/sh
 # These define the major/minor/patch versions of ncurses.
 NCURSES_MAJOR = 5
 NCURSES_MINOR = 6
-NCURSES_PATCH = 20080209
+NCURSES_PATCH = 20080223
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 60d0b70d170ab2f4a02a61be27eaf46f2b1c8fb0..d06d3a963a63105363eaf1f1bd62cefff7e1aa4a 100644 (file)
@@ -1,4 +1,4 @@
-.\" $Id: terminfo.tail,v 1.48 2007/06/02 20:30:40 tom Exp $
+.\" $Id: terminfo.tail,v 1.49 2008/02/16 20:57:43 tom Exp $
 .\" Beginning of terminfo.tail file
 .\" This file is part of ncurses.
 .\" See "terminfo.head" for copyright.
@@ -325,7 +325,9 @@ The \fB%\fR encodings have the following meanings:
 outputs `%'
 .TP
 %\fI[[\fP:\fI]flags][width[.precision]][\fPdoxXs\fI]\fP
-as in \fBprintf\fP, flags are [-+#] and space
+as in \fBprintf\fP, flags are [-+#] and space.
+Use a `:' to allow the next character to be a `-' flag,
+avoiding interpreting "%-" as an operator.
 .TP
 %c
 print pop() like %c in \fBprintf\fP
index 21ba95f34ed6e1a0d7bec77b13ef643916d2115d..835bb0bccae1e58b570dde770523352d5fecbfd5 100644 (file)
@@ -40,8 +40,9 @@
 */
 
 #include <curses.priv.h>
+#include <stddef.h>
 
-MODULE_ID("$Id: lib_newwin.c,v 1.44 2008/01/13 00:28:13 tom Exp $")
+MODULE_ID("$Id: lib_newwin.c,v 1.45 2008/02/23 20:57:58 tom Exp $")
 
 static WINDOW *
 remove_window_from_screen(WINDOW *win)
@@ -230,14 +231,7 @@ _nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags)
     if ((wp = typeCalloc(WINDOWLIST, 1)) == 0)
        returnWin(0);
 
-#ifdef USE_PTHREADS
-    {
-       pthread_mutexattr_t recattr;
-       memset(&recattr, 0, sizeof(recattr));
-       pthread_mutexattr_settype(&recattr, PTHREAD_MUTEX_NORMAL);
-       pthread_mutex_init(&(wp->mutex_use_window), &recattr);
-    }
-#endif
+    _nc_mutex_init(&(wp->mutex_use_window));
 
     win = &(wp->win);
 
index 1e748eeca7a610da4a965fc82ac4d81a4f96d728..ddf15a8a4eb4bb48bc6cb58f94bad03041050d13 100644 (file)
@@ -34,7 +34,7 @@
 
 
 /*
- * $Id: curses.priv.h,v 1.357 2008/01/13 00:33:10 tom Exp $
+ * $Id: curses.priv.h,v 1.359 2008/02/23 21:19:56 tom Exp $
  *
  *     curses.priv.h
  *
@@ -312,8 +312,10 @@ color_t;
 #define TR_GLOBAL_MUTEX(name) TR_MUTEX(_nc_globals.mutex_##name)
 
 #ifdef USE_PTHREADS
+
 #if USE_REENTRANT
 #include <pthread.h>
+extern NCURSES_EXPORT(void) _nc_mutex_init(pthread_mutex_t *);
 extern NCURSES_EXPORT(int) _nc_mutex_lock(pthread_mutex_t *);
 extern NCURSES_EXPORT(int) _nc_mutex_trylock(pthread_mutex_t *);
 extern NCURSES_EXPORT(int) _nc_mutex_unlock(pthread_mutex_t *);
@@ -327,7 +329,16 @@ extern NCURSES_EXPORT(void) _nc_unlock_window(WINDOW *);
 #else
 #error POSIX threads requires --enable-reentrant option
 #endif
-#else
+
+#if HAVE_NANOSLEEP
+#undef HAVE_NANOSLEEP
+#define HAVE_NANOSLEEP 0       /* nanosleep suspends all threads */
+#endif
+
+#else /* !USE_PTHREADS */
+
+#define _nc_mutex_init(obj)    /* nothing */
+
 #define _nc_lock_global(name)  /* nothing */
 #define _nc_try_global(name)    0
 #define _nc_unlock_global(name)        /* nothing */
@@ -335,7 +346,7 @@ extern NCURSES_EXPORT(void) _nc_unlock_window(WINDOW *);
 #define _nc_lock_window(name)  (void) TRUE
 #define _nc_unlock_window(name)        /* nothing */
 
-#endif
+#endif /* USE_PTHREADS */
 
 #define _nc_lock_screen(name)  /* nothing */
 #define _nc_unlock_screen(name)        /* nothing */
@@ -583,11 +594,9 @@ typedef struct {
        unsigned char   *tracetry_buf;
        size_t          tracetry_used;
 
-#ifndef USE_TERMLIB
        char            traceatr_color_buf[2][80];
        int             traceatr_color_sel;
        int             traceatr_color_last;
-#endif /* USE_TERMLIB */
 
 #endif /* TRACE */
 
index 21b854b92b6f840cc56df61c9d7df4cacca7ad68..e3affe40ee86c7709998a910e3655182efab170c 100644 (file)
@@ -41,7 +41,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_data.c,v 1.39 2008/01/13 01:21:59 tom Exp $")
+MODULE_ID("$Id: lib_data.c,v 1.40 2008/02/23 21:23:44 tom Exp $")
 
 /*
  * OS/2's native linker complains if we don't initialize public data when
@@ -109,7 +109,7 @@ NCURSES_EXPORT_VAR(SCREEN *) SP = NULL; /* Some linkers require initialized data
 #define CHARS_0s { '\0' }
 
 #define TGETENT_0 { 0L, FALSE, NULL, NULL, NULL }
-#define TGETENT_0s { TGETENT_0, TGETENT_0, TGETENT_0, TGETENT_0 } 
+#define TGETENT_0s { TGETENT_0, TGETENT_0, TGETENT_0, TGETENT_0 }
 
 NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
     0,                         /* have_sigwinch */
@@ -171,11 +171,9 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
     NULL,                      /* tracetry_buf */
     0,                         /* tracetry_used */
 
-#ifndef USE_TERMLIB
     { CHARS_0s, CHARS_0s },    /* traceatr_color_buf */
     0,                         /* traceatr_color_sel */
     -1,                                /* traceatr_color_last */
-#endif /* USE_TERMLIB */
 
 #endif /* TRACE */
 #ifdef USE_PTHREADS
@@ -236,20 +234,30 @@ NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = {
 
 /******************************************************************************/
 #ifdef USE_PTHREADS
+NCURSES_EXPORT(void)
+_nc_mutex_init(pthread_mutex_t * obj)
+{
+    pthread_mutexattr_t recattr;
+
+    memset(&recattr, 0, sizeof(recattr));
+    pthread_mutexattr_settype(&recattr, PTHREAD_MUTEX_NORMAL);
+    pthread_mutex_init(obj, &recattr);
+}
+
 NCURSES_EXPORT(int)
-_nc_mutex_lock(pthread_mutex_t *obj)
+_nc_mutex_lock(pthread_mutex_t * obj)
 {
     return pthread_mutex_lock(obj);
 }
 
 NCURSES_EXPORT(int)
-_nc_mutex_trylock(pthread_mutex_t *obj)
+_nc_mutex_trylock(pthread_mutex_t * obj)
 {
     return pthread_mutex_trylock(obj);
 }
 
 NCURSES_EXPORT(int)
-_nc_mutex_unlock(pthread_mutex_t *obj)
+_nc_mutex_unlock(pthread_mutex_t * obj)
 {
     return pthread_mutex_unlock(obj);
 }
index 84322eb4a8da1053efa1a149e58a1ad6b07b56b0..d572b2d17c99b43ab2786ca725ccbc066926189a 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: demo_menus.c,v 1.22 2008/02/09 18:09:26 tom Exp $
+ * $Id: demo_menus.c,v 1.23 2008/02/23 23:06:49 tom Exp $
  *
  * Demonstrate a variety of functions from the menu library.
  * Thomas Dickey - 2005/4/9
@@ -130,14 +130,14 @@ wGetchar(WINDOW *win)
     while ((c = wgetch(win)) == CTRL('T')) {
        if (_nc_tracing) {
            save_trace = _nc_tracing;
-           _tracef("TOGGLE-TRACING OFF");
+           Trace(("TOGGLE-TRACING OFF"));
            _nc_tracing = 0;
        } else {
            _nc_tracing = save_trace;
        }
        trace(_nc_tracing);
        if (_nc_tracing)
-           _tracef("TOGGLE-TRACING ON");
+           Trace(("TOGGLE-TRACING ON"));
     }
 #else
     c = wgetch(win);
@@ -270,7 +270,7 @@ menu_destroy(MENU * m)
 #if 0
        if (count > 0) {
            while (*ip) {
-               _tracef("freeing item %d:%d", ip - menu_items(m), count);
+               Trace(("freeing item %d:%d", ip - menu_items(m), count));
                free_item(*ip++);
            }
        }
@@ -524,7 +524,7 @@ perform_trace_menu(int cmd)
                    newtrace |= t_tbl[item_index(*ip)].mask;
            }
            trace(newtrace);
-           _tracef("trace level interactively set to %s", tracetrace(_nc_tracing));
+           Trace(("trace level interactively set to %s", tracetrace(_nc_tracing)));
 
            (void) mvprintw(LINES - 2, 0,
                            "Trace level is %s\n", tracetrace(_nc_tracing));
index 85248c81665aad92f70c71e61d7ad624c82a547c..737731ea61298dfae2f687259bcd2d74f00dc891 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
  *
  * Generate timing statistics for vertical-motion optimization.
  *
- * $Id: hashtest.c,v 1.27 2007/07/21 17:45:09 tom Exp $
+ * $Id: hashtest.c,v 1.28 2008/02/23 23:02:41 tom Exp $
  */
 
-#ifdef TRACE
-#define Trace(p) _tracef p
-#define USE_TRACE 1
-#else
-#define Trace(p)               /* nothing */
-#define USE_TRACE 0
-#endif
-
 #include <test.priv.h>
 
 #define LO_CHAR ' '
index aa1c970305b911434eeb8e78213e4b842a2e7606..0e724a65df0bb51ad52ce834710eb1c13d952ee7 100644 (file)
@@ -40,7 +40,7 @@ AUTHOR
    Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
            Thomas E. Dickey (beginning revision 1.27 in 1996).
 
-$Id: ncurses.c,v 1.301 2008/02/09 17:19:55 tom Exp $
+$Id: ncurses.c,v 1.302 2008/02/23 23:07:28 tom Exp $
 
 ***************************************************************************/
 
@@ -183,14 +183,14 @@ wGetchar(WINDOW *win)
     while ((c = wgetch(win)) == CTRL('T')) {
        if (_nc_tracing) {
            save_trace = _nc_tracing;
-           _tracef("TOGGLE-TRACING OFF");
+           Trace(("TOGGLE-TRACING OFF"));
            _nc_tracing = 0;
        } else {
            _nc_tracing = save_trace;
        }
        trace(_nc_tracing);
        if (_nc_tracing)
-           _tracef("TOGGLE-TRACING ON");
+           Trace(("TOGGLE-TRACING ON"));
     }
 #else
     c = wgetch(win);
@@ -276,14 +276,14 @@ wGet_wchar(WINDOW *win, wint_t *result)
     while ((c = wget_wch(win, result)) == CTRL('T')) {
        if (_nc_tracing) {
            save_trace = _nc_tracing;
-           _tracef("TOGGLE-TRACING OFF");
+           Trace(("TOGGLE-TRACING OFF"));
            _nc_tracing = 0;
        } else {
            _nc_tracing = save_trace;
        }
        trace(_nc_tracing);
        if (_nc_tracing)
-           _tracef("TOGGLE-TRACING ON");
+           Trace(("TOGGLE-TRACING ON"));
     }
 #else
     c = wget_wch(win, result);
@@ -5079,7 +5079,7 @@ trace_set(void)
        if (item_value(*ip))
            newtrace |= t_tbl[item_index(*ip)].mask;
     trace(newtrace);
-    _tracef("trace level interactively set to %s", tracetrace(_nc_tracing));
+    Trace(("trace level interactively set to %s", tracetrace(_nc_tracing)));
 
     (void) mvprintw(LINES - 2, 0,
                    "Trace level is %s\n", tracetrace(_nc_tracing));
index fb5f203fc0b18bdcd564c1243f133fadef4fdf5f..0eabbcc754779e68714c518d705cb5f470703e5f 100644 (file)
@@ -29,7 +29,7 @@
 /****************************************************************************
  *  Author: Thomas E. Dickey                    1996-on                     *
  ****************************************************************************/
-/* $Id: test.priv.h,v 1.73 2008/02/10 00:12:55 tom Exp $ */
+/* $Id: test.priv.h,v 1.74 2008/02/23 23:02:41 tom Exp $ */
 
 #ifndef __TEST_PRIV_H
 #define __TEST_PRIV_H 1
@@ -547,5 +547,12 @@ use_window(WINDOW *win, int (*func) (WINDOW *, void *), void *data) \
 #define USING_WINDOW(w,func) func(w)
 #endif
 
+#ifdef TRACE
+#define Trace(p) _tracef p
+#define USE_TRACE 1
+#else
+#define Trace(p)               /* nothing */
+#define USE_TRACE 0
+#endif
 
 #endif /* __TEST_PRIV_H */
index 23b0ef4ae85c70792dae3b0ee12d7298942bbba5..d78f9b9621ed9c184140ad17cff8a9f7bcfa10ae 100644 (file)
@@ -61,7 +61,7 @@ Options:
   traces will be dumped.  The program stops and waits for one character of
   input at the beginning and end of the interval.
 
-  $Id: worm.c,v 1.55 2008/01/26 22:07:57 tom Exp $
+  $Id: worm.c,v 1.56 2008/02/23 23:08:57 tom Exp $
 */
 
 #include <test.priv.h>
@@ -321,12 +321,14 @@ static void *
 start_worm(void *arg)
 {
     unsigned long compare = 0;
+    Trace(("start_worm"));
     while (!quit_worm()) {
        while (compare < sequence) {
            ++compare;
            use_window(stdscr, draw_worm, arg);
        }
     }
+    Trace(("...start_worm (done)"));
     return NULL;
 }
 #endif
@@ -576,6 +578,7 @@ main(int argc, char *argv[])
        USING_WINDOW(stdscr, wrefresh);
     }
 
+    Trace(("Cleanup"));
     cleanup();
 #ifdef NO_LEAKS
     for (y = 0; y < LINES; y++) {
@@ -591,6 +594,7 @@ main(int argc, char *argv[])
     /*
      * Do this just in case one of the threads did not really exit.
      */
+    Trace(("join all threads"));
     for (n = 0; n < number; n++) {
        pthread_join(worm[n].thread, NULL);
     }