Merge pull request #309 from ggtakec/master

Check pthread prtability in configure as additional change for #307
This commit is contained in:
Takeshi Nakatani 2015-12-03 16:58:23 +09:00
commit 87d04acb2f
2 changed files with 24 additions and 1 deletions

View File

@ -228,6 +228,29 @@ dnl ----------------------------------------------
dnl malloc_trim function
AC_CHECK_FUNCS([malloc_trim])
dnl ----------------------------------------------
dnl check symbols/macros/enums
dnl ----------------------------------------------
dnl PTHREAD_MUTEX_RECURSIVE
AC_MSG_CHECKING([pthread mutex recursive])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <pthread.h>]],
[[int i = PTHREAD_MUTEX_RECURSIVE;]])
],
[AC_DEFINE(S3FS_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE, [Define if you have PTHREAD_MUTEX_RECURSIVE])
AC_MSG_RESULT(PTHREAD_MUTEX_RECURSIVE)
],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <pthread.h>]],
[[int i = PTHREAD_MUTEX_RECURSIVE_NP;]])
],
[AC_DEFINE(S3FS_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, [Define if you have PTHREAD_MUTEX_RECURSIVE_NP])
AC_MSG_RESULT(PTHREAD_MUTEX_RECURSIVE_NP)
],
[AC_MSG_ERROR([do not have PTHREAD_MUTEX_RECURSIVE symbol])])
]
)
dnl ----------------------------------------------
dnl output files
dnl ----------------------------------------------

View File

@ -619,7 +619,7 @@ FdEntity::FdEntity(const char* tpath, const char* cpath)
try{
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); // recursive mutex
pthread_mutexattr_settype(&attr, S3FS_MUTEX_RECURSIVE); // recursive mutex
pthread_mutex_init(&fdent_lock, &attr);
is_lock_init = true;
}catch(exception& e){