Hi, Greg Troxel <[EMAIL PROTECTED]> writes:
> I just updated pkgsrc to 1.8.2, and on NetBSD-current/i386 make check > fails in the thread test with: Does this happen with previous 1.8 releases? > Perhaps someone could try this on Linux with the right magic debug > variables to object to unlocking an unlocked mutex. (On NetBSD, the > default behavior is to abort on any operation which the standard says is > undefined.) I tried the attached patch (which does what Kevin suggested) on GNU/Linux, and recompiled with `-DSCM_USE_ERROR_CHECKING_MUTEXES=1'. I then run the whole test-suite (on i686), without observing anything special. Running `threads.test' in a loop didn't trigger the error either. Further investigation is needed... Ludovic.
--- orig/libguile/pthread-threads.h +++ mod/libguile/pthread-threads.h @@ -43,13 +43,51 @@ /* Mutexes */ -#define SCM_I_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER +#ifdef SCM_USE_ERROR_CHECKING_MUTEXES +# if (!defined PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP) || (!defined __GNUC__) +# undef SCM_USE_ERROR_CHECKING_MUTEXES +# endif +#endif + +#ifdef SCM_USE_ERROR_CHECKING_MUTEXES +# define SCM_I_PTHREAD_MUTEX_INITIALIZER PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP +#else +# define SCM_I_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER +#endif + #define scm_i_pthread_mutex_t pthread_mutex_t #define scm_i_pthread_mutex_init pthread_mutex_init #define scm_i_pthread_mutex_destroy pthread_mutex_destroy #define scm_i_pthread_mutex_trylock pthread_mutex_trylock -#define scm_i_pthread_mutex_lock pthread_mutex_lock -#define scm_i_pthread_mutex_unlock pthread_mutex_unlock + +#ifdef SCM_USE_ERROR_CHECKING_MUTEXES + +# define scm_i_pthread_mutex_lock(m) \ + ({ \ + int mutex_err_; \ + mutex_err_ = pthread_mutex_lock (m); \ + if (mutex_err_) \ + scm_syserror_msg ("mutex_lock", "`pthread_mutex_lock' failed", \ + SCM_EOL, mutex_err_); \ + mutex_err_; \ + }) +# define scm_i_pthread_mutex_unlock(m) \ + ({ \ + int mutex_err_; \ + mutex_err_ = pthread_mutex_unlock (m); \ + if (mutex_err_) \ + scm_syserror_msg ("mutex_unlock", "`pthread_mutex_unlock' failed", \ + SCM_EOL, mutex_err_); \ + mutex_err_; \ + }) + +#else /* !SCM_USE_ERROR_CHECKING_MUTEXES */ + +# define scm_i_pthread_mutex_lock pthread_mutex_lock +# define scm_i_pthread_mutex_unlock pthread_mutex_unlock + +#endif /* !SCM_USE_ERROR_CHECKING_MUTEXES */ + extern pthread_mutexattr_t scm_i_pthread_mutexattr_recursive[1]; /* Condition variables
_______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel