Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.1
ncurses
ncurses-5.6-pthread.dif
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ncurses-5.6-pthread.dif of Package ncurses
--- configure +++ configure 2008-08-15 17:26:58.354794367 +0200 @@ -9310,6 +9310,7 @@ if test "$with_pthread" = "yes" ; then EOF enable_reentrant=yes + PTHREAD=-lpthread fi # Reentrant code has to be opaque; there's little advantage to making ncurses @@ -9333,7 +9334,8 @@ if test "$with_reentrant" = yes ; then cf_cv_enable_opaque="NCURSES_INTERNALS" NCURSES_OPAQUE=1 NCURSES_SIZE_T=int - LIB_SUFFIX="t${LIB_SUFFIX}" +# remove pthread library from $LIBS +LIBS=`echo "$LIBS" | sed -e 's/-lpthread[ ]//g' -e 's/-lpthread$//'` cat >>confdefs.h <<\EOF #define USE_REENTRANT 1 EOF @@ -16785,6 +16787,7 @@ s,@NCURSES_EXT_COLORS@,$NCURSES_EXT_COLO s,@NCURSES_MOUSE_VERSION@,$NCURSES_MOUSE_VERSION,;t t s,@NCURSES_SBOOL@,$NCURSES_SBOOL,;t t s,@NCURSES_XNAMES@,$NCURSES_XNAMES,;t t +s,@PTHREAD@,$PTHREAD,;t t s,@cf_cv_enable_reentrant@,$cf_cv_enable_reentrant,;t t s,@cf_cv_enable_opaque@,$cf_cv_enable_opaque,;t t s,@NCURSES_OPAQUE@,$NCURSES_OPAQUE,;t t --- configure.in +++ configure.in 2008-08-15 17:24:08.626825950 +0200 @@ -972,9 +972,11 @@ test "$with_colorfgbg" = yes && AC_DEFIN # This is still experimental (20080329), but should ultimately be moved to # the script-block --with-normal, etc. CF_WITH_PTHREAD +AC_SUBST(PTHREAD) if test "$with_pthread" = "yes" ; then AC_DEFINE(USE_PTHREADS) enable_reentrant=yes + PTHREAD=-lpthread fi # Reentrant code has to be opaque; there's little advantage to making ncurses @@ -992,7 +994,7 @@ if test "$with_reentrant" = yes ; then cf_cv_enable_opaque="NCURSES_INTERNALS" NCURSES_OPAQUE=1 NCURSES_SIZE_T=int - LIB_SUFFIX="t${LIB_SUFFIX}" + CF_REMOVE_LIB(LIBS,$LIBS,pthread) AC_DEFINE(USE_REENTRANT) CF_NCURSES_ABI_6 else --- ncurses/curses.priv.h +++ ncurses/curses.priv.h 2008-08-15 14:54:39.906243654 +0200 @@ -330,6 +330,7 @@ NCURSES_EXPORT(int *) _nc_ptr_Cols (void #if USE_REENTRANT #include <pthread.h> +extern NCURSES_EXPORT(void) _nc_init_pthreads(void); 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 *); @@ -337,11 +338,43 @@ extern NCURSES_EXPORT(int) _nc_mutex_unl #define _nc_lock_global(name) _nc_mutex_lock(&_nc_globals.mutex_##name) #define _nc_try_global(name) _nc_mutex_trylock(&_nc_globals.mutex_##name) #define _nc_unlock_global(name) _nc_mutex_unlock(&_nc_globals.mutex_##name) +#define FORCE_PTHREADS 0 #else #error POSIX threads requires --enable-reentrant option #endif +#if defined(__GNUC__) && defined(__linux__) +# if defined __USE_ISOC99 +# define _cat_pragma(exp) _Pragma(#exp) +# define _weak_pragma(exp) _cat_pragma(weak name) +# else +# define _weak_pragma(exp) +# endif +# define _declare(name) __extension__ extern __typeof__(name) name +# define weak_symbol(name) _weak_pragma(name) _declare(name) __attribute__((weak)) +# ifdef USE_PTHREADS +# undef FORCE_PTHREADS +# define FORCE_PTHREADS 1 +# endif +#endif + +#ifdef USE_PTHREADS +# if FORCE_PTHREADS +weak_symbol(pthread_sigmask); +weak_symbol(pthread_self); +weak_symbol(pthread_equal); +weak_symbol(pthread_mutex_init); +weak_symbol(pthread_mutex_lock); +weak_symbol(pthread_mutex_unlock); +weak_symbol(pthread_mutex_trylock); +weak_symbol(pthread_mutexattr_settype); +extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *); +# undef sigprocmask +# define sigprocmask _nc_sigprocmask +# endif +#endif + #if HAVE_NANOSLEEP #undef HAVE_NANOSLEEP #define HAVE_NANOSLEEP 0 /* nanosleep suspends all threads */ @@ -349,6 +382,7 @@ extern NCURSES_EXPORT(int) _nc_mutex_unl #else /* !USE_PTHREADS */ +#define _nc_init_pthreads() /* nothing */ #define _nc_mutex_init(obj) /* nothing */ #define _nc_lock_global(name) /* nothing */ @@ -616,10 +650,12 @@ typedef struct { #endif /* TRACE */ #ifdef USE_PTHREADS - pthread_mutex_t mutex_curses; - pthread_mutex_t mutex_tst_tracef; - pthread_mutex_t mutex_tracef; - int nested_tracef; + pthread_mutex_t mutex_curses; + pthread_mutex_t mutex_tst_tracef; + pthread_mutex_t mutex_tracef; + int nested_tracef; + int use_pthreads; +#define _nc_use_pthreads _nc_globals.use_pthreads #endif } NCURSES_GLOBALS; --- ncurses/base/lib_getch.c +++ ncurses/base/lib_getch.c 2008-08-15 14:59:26.569224183 +0200 @@ -260,7 +260,7 @@ recur_wrefresh(WINDOW *win) { #ifdef USE_PTHREADS SCREEN *sp = _nc_screen_of(win); - if (sp != SP) { + if (_nc_use_pthreads && sp != SP) { SCREEN *save_SP; /* temporarily switch to the window's screen to check/refresh */ @@ -286,7 +286,7 @@ recur_wgetnstr(WINDOW *win, char *buf) if (sp != 0) { #ifdef USE_PTHREADS - if (sp != SP) { + if (_nc_use_pthreads && sp != SP) { SCREEN *save_SP; /* temporarily switch to the window's screen to get cooked input */ --- ncurses/base/lib_initscr.c +++ ncurses/base/lib_initscr.c 2008-08-15 14:37:44.598653367 +0200 @@ -57,7 +57,9 @@ initscr(void) START_TRACE(); T((T_CALLED("initscr()"))); + _nc_init_pthreads(); _nc_lock_global(curses); + /* Portable applications must not call initscr() more than once */ if (!_nc_globals.init_screen) { _nc_globals.init_screen = TRUE; --- ncurses/base/lib_newterm.c +++ ncurses/base/lib_newterm.c 2008-08-15 14:37:33.293589963 +0200 @@ -130,6 +130,7 @@ newterm(NCURSES_CONST char *name, FILE * START_TRACE(); T((T_CALLED("newterm(\"%s\",%p,%p)"), name, ofp, ifp)); + _nc_init_pthreads(); _nc_lock_global(curses); current = SP; --- ncurses/tinfo/lib_data.c +++ ncurses/tinfo/lib_data.c 2008-08-15 14:42:37.974271725 +0200 @@ -181,6 +181,7 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_ PTHREAD_MUTEX_INITIALIZER, /* mutex_tst_tracef */ PTHREAD_MUTEX_INITIALIZER, /* mutex_tracef */ 0, /* nested_tracef */ + 0, /* use_pthreads */ #endif }; @@ -248,6 +249,27 @@ init_global_mutexes(void) } } +NCURSES_EXPORT(void) +_nc_init_pthreads(void) +{ + if (_nc_use_pthreads) + return; +# if FORCE_PTHREADS + if ((pthread_mutex_init) == 0) + return; + if ((pthread_mutex_lock) == 0) + return; + if ((pthread_mutex_unlock) == 0) + return; + if ((pthread_mutex_trylock) == 0) + return; + if ((pthread_mutexattr_settype) == 0) + return; +# endif + _nc_use_pthreads = 1; + init_global_mutexes(); +} + /* * 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 @@ -262,6 +284,8 @@ _nc_mutex_init(pthread_mutex_t * obj) { pthread_mutexattr_t recattr; + if (_nc_use_pthreads == 0) + return; memset(&recattr, 0, sizeof(recattr)); pthread_mutexattr_settype(&recattr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init(obj, &recattr); @@ -270,21 +294,39 @@ _nc_mutex_init(pthread_mutex_t * obj) NCURSES_EXPORT(int) _nc_mutex_lock(pthread_mutex_t * obj) { - init_global_mutexes(); + if (_nc_use_pthreads == 0) + return 0; return pthread_mutex_lock(obj); } NCURSES_EXPORT(int) _nc_mutex_trylock(pthread_mutex_t * obj) { - init_global_mutexes(); + if (_nc_use_pthreads == 0) + return 0; return pthread_mutex_trylock(obj); } NCURSES_EXPORT(int) _nc_mutex_unlock(pthread_mutex_t * obj) { - init_global_mutexes(); + if (_nc_use_pthreads == 0) + return 0; return pthread_mutex_unlock(obj); } + +#if FORCE_PTHREADS +/* + * NB: sigprocmask(2) is global but pthread_sigmask(3p) + * only for the calling thread. + */ +NCURSES_EXPORT(int) +_nc_sigprocmask(int how, const sigset_t *newmask, sigset_t *oldmask) +{ + if ((pthread_sigmask)) + return pthread_sigmask(how, newmask, oldmask); + else + return sigprocmask(how, newmask, oldmask); +} +#endif #endif /* USE_PTHREADS */ --- ncurses/tinfo/lib_options.c +++ ncurses/tinfo/lib_options.c 2008-08-15 15:02:29.662454211 +0200 @@ -245,7 +245,7 @@ _nc_keypad(SCREEN *sp, bool flag) * has wgetch() reading in more than one thread. putp() and below * may use SP explicitly. */ - if (sp != SP) { + if (_nc_use_pthreads && sp != SP) { SCREEN *save_sp; /* cannot use use_screen(), since that is not in tinfo library */ --- ncurses/trace/lib_trace.c +++ ncurses/trace/lib_trace.c 2008-08-15 14:26:03.884728534 +0200 @@ -180,6 +180,9 @@ _nc_va_tracef(const char *fmt, va_list a * Rather than add the complication of a per-thread stack, just * show the thread-id in each line of the trace. */ +# if FORCE_PTHREADS + if ((pthread_self)) +# endif fprintf(TraceFP, "%#lx:", (long) pthread_self()); #endif if (before || after) { --- test/Makefile.in +++ test/Makefile.in 2008-08-15 17:21:56.826424899 +0200 @@ -95,7 +95,7 @@ LIBS_DEFAULT = $(TEST_ARGS) @LIBS@ $(TES LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_DEFAULT) # use these for linking with the (n)curses library -LIBS_CURSES = `echo "$(TEST_ARGS) @LIBS@" | sed -e 's/-lform.*-lpanel[^ ]*//'` $(TEST_LIBS) $(MATH_LIB) +LIBS_CURSES = `echo "$(TEST_ARGS) @LIBS@" | sed -e 's/-lform.*-lpanel[^ ]*//'` $(TEST_LIBS) $(MATH_LIB) @PTHREAD@ LDFLAGS_CURSES = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_CURSES) # use these for linking with the tinfo library if we have it, or curses library if not
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor