summaryrefslogtreecommitdiff
path: root/lib/replace/system/threads.h
AgeCommit message (Collapse)AuthorFilesLines
2018-07-24replace: add checks for atomic_thread_fence(memory_order_seq_cst) and add ↵Stefan Metzmacher1-0/+27
possible fallbacks This implements a full memory barrier. On ubuntu amd64 with results in an 'mfence' instruction. This is required to syncronization between threads, where there's typically only one write of a memory that should be synced between all threads with the barrier. Much more details can be found here: https://gcc.gnu.org/onlinedocs/gcc-7.3.0/gcc/_005f_005fatomic-Builtins.html#g_t_005f_005fatomic-Builtins https://gcc.gnu.org/onlinedocs/gcc-7.3.0/gcc/_005f_005fsync-Builtins.html#g_t_005f_005fsync-Builtins The main one we use seems to be in C11 via stdatomic.h, the oldest fallback is __sync_synchronize(), which is available since 2005 in gcc. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2015-06-12lib/replace: fix PTHREAD_MUTEX_ROBUST fallback to PTHREAD_MUTEX_ROBUST_NP on ↵Stefan Metzmacher1-6/+3
solaris 11 Without this we got the following defines in config.h: #define HAVE_DECL_PTHREAD_MUTEXATTR_SETROBUST_NP 1 #define HAVE_DECL_PTHREAD_MUTEX_CONSISTENT_NP 1 #define HAVE_PTHREAD_MUTEXATTR_SETROBUST 1 #define HAVE_PTHREAD_MUTEX_CONSISTENT 1 #define HAVE_ROBUST_MUTEXES 1 #define USE_TDB_MUTEX_LOCKING 1 And the build failed with PTHREAD_MUTEX_ROBUST being unknown. Note that PTHREAD_MUTEX_ROBUST and PTHREAD_MUTEX_ROBUST_NP are enum values while they're defines on solaris 11 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11319 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2014-05-22libreplace: Define PTHREAD_MUTEX_ROBUST along with pthread_mutexattr_setrobustVolker Lendecke1-0/+8
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2014-05-22libreplace: Add support for pthread_mutex_consistentVolker Lendecke1-0/+5
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2014-05-22libreplace: Add support for pthread_mutexattr_setrobustVolker Lendecke1-0/+35
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>