-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1208 2008/02/23 21:26:58 tom Exp $
+-- $Id: NEWS,v 1.1209 2008/03/01 20:02:41 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
+20080301
+ + fixes from 20080223 resolved issue with mutexes; change to use
+ recursive mutexes to fix memory leak in delwin() as called from
+ _nc_free_and_exit().
+
20080223
+ fix a size-difference in _nc_globals which caused hanging of mutex
lock/unlock when termlib was built separately.
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.631 2008/02/23 14:51:29 tom Exp $
+# $Id: dist.mk,v 1.632 2008/03/01 16:53:24 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 6
-NCURSES_PATCH = 20080223
+NCURSES_PATCH = 20080301
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
/*
- * $Id: curses.priv.h,v 1.359 2008/02/23 21:19:56 tom Exp $
+ * $Id: curses.priv.h,v 1.360 2008/03/01 20:36:39 tom Exp $
*
* curses.priv.h
*
#define _nc_lock_screen(name) /* nothing */
#define _nc_unlock_screen(name) /* nothing */
+#if HAVE_GETTIMEOFDAY
+# define PRECISE_GETTIME 1
+# define TimeType struct timeval
+#else
+# define PRECISE_GETTIME 0
+# define TimeType time_t
+#endif
+
/*
* Definitions for color pairs
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_data.c,v 1.40 2008/02/23 21:23:44 tom Exp $")
+MODULE_ID("$Id: lib_data.c,v 1.42 2008/03/02 00:04:32 tom Exp $")
/*
* OS/2's native linker complains if we don't initialize public data when
/******************************************************************************/
#ifdef USE_PTHREADS
+static void
+init_global_mutexes(void)
+{
+ static bool initialized = FALSE;
+
+ if (!initialized) {
+ initialized = TRUE;
+ _nc_mutex_init(&_nc_globals.mutex_set_SP);
+ _nc_mutex_init(&_nc_globals.mutex_use_screen);
+ _nc_mutex_init(&_nc_globals.mutex_use_window);
+ _nc_mutex_init(&_nc_globals.mutex_windowlist);
+ _nc_mutex_init(&_nc_globals.mutex_tst_tracef);
+ _nc_mutex_init(&_nc_globals.mutex_tracef);
+ }
+}
+
+/*
+ * Use recursive mutexes if we have them - they're part of Unix98.
+ * For the cases where we do not, _nc_mutex_trylock() is used to avoid a
+ * deadlock, at the expense of memory leaks and unexpected failures that
+ * may not be handled by typical clients.
+ *
+ * FIXME - need configure check for PTHREAD_MUTEX_RECURSIVE, define it to
+ * PTHREAD_MUTEX_NORMAL if not supported.
+ */
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_mutexattr_settype(&recattr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(obj, &recattr);
}
NCURSES_EXPORT(int)
_nc_mutex_lock(pthread_mutex_t * obj)
{
+ init_global_mutexes();
return pthread_mutex_lock(obj);
}
NCURSES_EXPORT(int)
_nc_mutex_trylock(pthread_mutex_t * obj)
{
+ init_global_mutexes();
return pthread_mutex_trylock(obj);
}
NCURSES_EXPORT(int)
_nc_mutex_unlock(pthread_mutex_t * obj)
{
+ init_global_mutexes();
return pthread_mutex_unlock(obj);
}
#endif /* USE_PTHREADS */
/****************************************************************************
- * 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 *
# endif
#endif
-MODULE_ID("$Id: lib_twait.c,v 1.54 2007/08/11 16:32:48 tom Exp $")
-
-#if HAVE_GETTIMEOFDAY
-# define PRECISE_GETTIME 1
-# define TimeType struct timeval
-#else
-# define PRECISE_GETTIME 0
-# define TimeType time_t
-#endif
+MODULE_ID("$Id: lib_twait.c,v 1.55 2008/03/01 22:08:31 tom Exp $")
static long
_nc_gettime(TimeType * t0, bool first)