Skip to content

Commit

Permalink
Merge pull request #147 from kspangsege/ks-missing-pthread_mutex_cons…
Browse files Browse the repository at this point in the history
…istent

Handle missing pthread_mutex_consistent() in glibc versions prior to 2.12
  • Loading branch information
finnschiermer committed Sep 9, 2013
2 parents 8815b51 + 43a6a6d commit 25159c8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/tightdb/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,25 @@
# include <unistd.h>
#endif

// Unfortunately Older Ubuntu releases such as 10.04 reports
// support for robust mutexes by setting _POSIX_THREADS = 200809L and
// _POSIX_THREAD_PROCESS_SHARED = 200809L even though they do not
// provide pthread_mutex_consistent(). See also
// http://www.gnu.org/software/gnulib/manual/gnulib.html#pthread_005fmutex_005fconsistent.
// Support was added to glibc 2.12, so we disable for earlier versions of glibs

#ifdef _POSIX_THREAD_PROCESS_SHARED
# if _POSIX_THREAD_PROCESS_SHARED != -1 // can apparently also be -1
# define TIGHTDB_HAVE_PTHREAD_PROCESS_SHARED
# if !defined _WIN32 // robust not supported by our windows pthreads port
# if _POSIX_THREADS >= 200809L
# define TIGHTDB_HAVE_ROBUST_PTHREAD_MUTEX
# ifdef __GNU_LIBRARY__
# if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 12)
# define TIGHTDB_HAVE_ROBUST_PTHREAD_MUTEX
# endif
# else
# define TIGHTDB_HAVE_ROBUST_PTHREAD_MUTEX
# endif
# endif
# endif
# endif
Expand Down
Binary file added src/tightdb/tightdbd
Binary file not shown.
Binary file added src/tightdb/tightdbd-noinst
Binary file not shown.

0 comments on commit 25159c8

Please sign in to comment.