Skip to content

Commit 00665ba

Browse files
committed
Use portable variant of some pthread functions instead non-portable one (non-portable was needed for ancient glibc versions)
1 parent 4556f39 commit 00665ba

File tree

9 files changed

+39
-39
lines changed

9 files changed

+39
-39
lines changed

configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -955,9 +955,9 @@ AC_CHECK_FUNCS(clock_gettime)
955955

956956
dnl Checks for pthread functions
957957
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
958-
AC_CHECK_FUNCS(pthread_mutexattr_setrobust_np)
959-
AC_CHECK_FUNCS(pthread_mutex_consistent_np)
960-
AC_CHECK_FUNCS(pthread_rwlockattr_setkind_np)
958+
AC_CHECK_FUNCS(pthread_mutexattr_setrobust)
959+
AC_CHECK_FUNCS(pthread_mutex_consistent)
960+
AC_CHECK_FUNCS(pthread_rwlockattr_setkind)
961961
AC_CHECK_FUNCS(pthread_cancel)
962962
AC_CHECK_FUNCS(pthread_atfork)
963963
AC_CHECK_FUNCS(sigset)

src/common/classes/rwlock.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,12 @@ class RWLock : public Reasons
208208

209209
void init()
210210
{
211-
#if defined(LINUX) && !defined(USE_VALGRIND) && defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP)
211+
#if defined(LINUX) && !defined(USE_VALGRIND) && defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND)
212212
pthread_rwlockattr_t attr;
213213
if (pthread_rwlockattr_init(&attr))
214214
system_call_failed::raise("pthread_rwlockattr_init");
215215
// Do not worry if target misses support for this option
216-
pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
216+
pthread_rwlockattr_setkind(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE);
217217
if (pthread_rwlock_init(&lock, NULL))
218218
system_call_failed::raise("pthread_rwlock_init");
219219
if (pthread_rwlockattr_destroy(&attr))

src/common/isc_s_proto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
#ifdef UNIX
5757

58-
#if defined(HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP) && defined(HAVE_PTHREAD_MUTEX_CONSISTENT_NP)
58+
#if defined(HAVE_PTHREAD_MUTEXATTR_SETROBUST) && defined(HAVE_PTHREAD_MUTEX_CONSISTENT)
5959
#define USE_ROBUST_MUTEX
6060
#endif // ROBUST mutex
6161

src/common/isc_sync.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,7 @@ SharedMemoryBase::SharedMemoryBase(const TEXT* filename, ULONG length, IpcObject
14581458
if (!bugFlag)
14591459
{
14601460
#endif
1461-
LOG_PTHREAD_ERROR(pthread_mutexattr_setrobust_np(&mattr, PTHREAD_MUTEX_ROBUST_NP));
1461+
LOG_PTHREAD_ERROR(pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST));
14621462
#ifdef BUGGY_LINUX_MUTEX
14631463
}
14641464
#endif
@@ -2755,7 +2755,7 @@ void SharedMemoryBase::mutexLock()
27552755
{
27562756
// We always perform check for dead process
27572757
// Therefore may safely mark mutex as recovered
2758-
LOG_PTHREAD_ERROR(pthread_mutex_consistent_np(sh_mem_mutex->mtx_mutex));
2758+
LOG_PTHREAD_ERROR(pthread_mutex_consistent(sh_mem_mutex->mtx_mutex));
27592759
state = 0;
27602760
}
27612761
#endif
@@ -2783,7 +2783,7 @@ bool SharedMemoryBase::mutexLockCond()
27832783
{
27842784
// We always perform check for dead process
27852785
// Therefore may safely mark mutex as recovered
2786-
LOG_PTHREAD_ERROR(pthread_mutex_consistent_np(sh_mem_mutex->mtx_mutex));
2786+
LOG_PTHREAD_ERROR(pthread_mutex_consistent(sh_mem_mutex->mtx_mutex));
27872787
state = 0;
27882788
}
27892789
#endif

src/include/cross/android.arm64

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,14 @@
305305
/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */
306306
/* undef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL */
307307

308-
/* Define to 1 if you have the `pthread_mutexattr_setrobust_np' function. */
309-
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP */
308+
/* Define to 1 if you have the `pthread_mutexattr_setrobust' function. */
309+
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST */
310310

311-
/* Define to 1 if you have the `pthread_mutex_consistent_np' function. */
312-
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT_NP */
311+
/* Define to 1 if you have the `pthread_mutex_consistent' function. */
312+
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT */
313313

314-
/* Define to 1 if you have the `pthread_rwlockattr_setkind_np' function. */
315-
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP */
314+
/* Define to 1 if you have the `pthread_rwlockattr_setkind' function. */
315+
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND */
316316

317317
/* Define to 1 if you have the <pwd.h> header file. */
318318
#define HAVE_PWD_H 1

src/include/cross/android.arme

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,14 @@
311311
/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */
312312
/* undef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL */
313313

314-
/* Define to 1 if you have the `pthread_mutexattr_setrobust_np' function. */
315-
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP */
314+
/* Define to 1 if you have the `pthread_mutexattr_setrobust' function. */
315+
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST */
316316

317-
/* Define to 1 if you have the `pthread_mutex_consistent_np' function. */
318-
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT_NP */
317+
/* Define to 1 if you have the `pthread_mutex_consistent' function. */
318+
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT */
319319

320-
/* Define to 1 if you have the `pthread_rwlockattr_setkind_np' function. */
321-
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP */
320+
/* Define to 1 if you have the `pthread_rwlockattr_setkind' function. */
321+
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND */
322322

323323
/* Define to 1 if you have the <pwd.h> header file. */
324324
#define HAVE_PWD_H 1

src/include/cross/android.x86

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,14 @@
305305
/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */
306306
/* undef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL */
307307

308-
/* Define to 1 if you have the `pthread_mutexattr_setrobust_np' function. */
309-
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP */
308+
/* Define to 1 if you have the `pthread_mutexattr_setrobust' function. */
309+
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST */
310310

311-
/* Define to 1 if you have the `pthread_mutex_consistent_np' function. */
312-
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT_NP */
311+
/* Define to 1 if you have the `pthread_mutex_consistent' function. */
312+
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT */
313313

314-
/* Define to 1 if you have the `pthread_rwlockattr_setkind_np' function. */
315-
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP */
314+
/* Define to 1 if you have the `pthread_rwlockattr_setkind' function. */
315+
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND */
316316

317317
/* Define to 1 if you have the <pwd.h> header file. */
318318
#define HAVE_PWD_H 1

src/include/cross/android.x86_64

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,14 @@
305305
/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */
306306
/* undef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL */
307307

308-
/* Define to 1 if you have the `pthread_mutexattr_setrobust_np' function. */
309-
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP */
308+
/* Define to 1 if you have the `pthread_mutexattr_setrobust' function. */
309+
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST */
310310

311-
/* Define to 1 if you have the `pthread_mutex_consistent_np' function. */
312-
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT_NP */
311+
/* Define to 1 if you have the `pthread_mutex_consistent' function. */
312+
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT */
313313

314-
/* Define to 1 if you have the `pthread_rwlockattr_setkind_np' function. */
315-
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP */
314+
/* Define to 1 if you have the `pthread_rwlockattr_setkind' function. */
315+
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND */
316316

317317
/* Define to 1 if you have the <pwd.h> header file. */
318318
#define HAVE_PWD_H 1

src/include/gen/autoconfig.h.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -487,14 +487,14 @@
487487
/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */
488488
#cmakedefine HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL 1
489489

490-
/* Define to 1 if you have the `pthread_mutexattr_setrobust_np' function. */
491-
#cmakedefine HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP 1
490+
/* Define to 1 if you have the `pthread_mutexattr_setrobust' function. */
491+
#cmakedefine HAVE_PTHREAD_MUTEXATTR_SETROBUST 1
492492

493-
/* Define to 1 if you have the `pthread_mutex_consistent_np' function. */
494-
#cmakedefine HAVE_PTHREAD_MUTEX_CONSISTENT_NP 1
493+
/* Define to 1 if you have the `pthread_mutex_consistent' function. */
494+
#cmakedefine HAVE_PTHREAD_MUTEX_CONSISTENT 1
495495

496-
/* Define to 1 if you have the `pthread_rwlockattr_setkind_np' function. */
497-
#cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP 1
496+
/* Define to 1 if you have the `pthread_rwlockattr_setkind' function. */
497+
#cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND 1
498498

499499
/* Define to 1 if you have the `qsort_r' function. */
500500
#cmakedefine HAVE_QSORT_R 1

0 commit comments

Comments
 (0)