diff --git a/configure.ac b/configure.ac index 98506323..7a5ab62b 100644 --- a/configure.ac +++ b/configure.ac @@ -115,8 +115,7 @@ AC_FUNC_VPRINTF AC_CHECK_FUNCS([alarm alphasort atexit bzero dup2 endgrent endpwent fcntl \ getcwd getpeerucred getpeereid gettimeofday inet_ntoa memmove \ memset mkdir scandir select socket strcasecmp strchr strdup \ - strerror strrchr strspn strstr pthread_spin_lock \ - pthread_spin_unlock pthread_setschedparam \ + strerror strrchr strspn strstr pthread_setschedparam \ sched_get_priority_max sched_setscheduler]) AC_CONFIG_FILES([Makefile @@ -273,7 +272,6 @@ AC_ARG_ENABLE([augeas], [ enable_augeas="no" ]) AM_CONDITIONAL(INSTALL_AUGEAS, test x$enable_augeas = xyes) - AC_ARG_WITH([initddir], [ --with-initddir=DIR : path to init script directory. ], [ INITDDIR="$withval" ], diff --git a/exec/logsys.c b/exec/logsys.c index 9cef381e..cef745cd 100644 --- a/exec/logsys.c +++ b/exec/logsys.c @@ -192,17 +192,9 @@ static sem_t logsys_thread_start; static sem_t logsys_print_finished; -#if defined(HAVE_PTHREAD_SPIN_LOCK) -static pthread_spinlock_t logsys_flt_spinlock; -#else static pthread_mutex_t logsys_flt_mutex = PTHREAD_MUTEX_INITIALIZER; -#endif -#if defined(HAVE_PTHREAD_SPIN_LOCK) -static pthread_spinlock_t logsys_wthread_spinlock; -#else static pthread_mutex_t logsys_wthread_mutex = PTHREAD_MUTEX_INITIALIZER; -#endif static int logsys_buffer_full = 0; @@ -309,16 +301,6 @@ error_exit: return (error_return); } -#if defined(HAVE_PTHREAD_SPIN_LOCK) -static void logsys_flt_lock (void) -{ - pthread_spin_lock (&logsys_flt_spinlock); -} -static void logsys_flt_unlock (void) -{ - pthread_spin_unlock (&logsys_flt_spinlock); -} -#else static void logsys_flt_lock (void) { pthread_mutex_lock (&logsys_flt_mutex); @@ -327,18 +309,7 @@ static void logsys_flt_unlock (void) { pthread_mutex_unlock (&logsys_flt_mutex); } -#endif -#if defined(HAVE_PTHREAD_SPIN_LOCK) -static void logsys_wthread_lock (void) -{ - pthread_spin_lock (&logsys_wthread_spinlock); -} -static void logsys_wthread_unlock (void) -{ - pthread_spin_unlock (&logsys_wthread_spinlock); -} -#else static void logsys_wthread_lock (void) { pthread_mutex_lock (&logsys_wthread_mutex); @@ -347,7 +318,6 @@ static void logsys_wthread_unlock (void) { pthread_mutex_unlock (&logsys_wthread_mutex); } -#endif /* * Before any write operation, a reclaim on the buffer area must be executed @@ -1068,11 +1038,6 @@ int _logsys_rec_init (unsigned int fltsize) sem_init (&logsys_print_finished, 0, 0); -#if defined(HAVE_PTHREAD_SPIN_LOCK) - pthread_spin_init (&logsys_flt_spinlock, 1); - pthread_spin_init (&logsys_wthread_spinlock, 1); -#endif - /* * XXX: kill me for 1.1 because I am a dirty hack * temporary workaround that will be replaced by supporting @@ -1090,11 +1055,6 @@ int _logsys_rec_init (unsigned int fltsize) if (res == -1) { sem_destroy (&logsys_thread_start); sem_destroy (&logsys_print_finished); -#if defined(HAVE_PTHREAD_SPIN_LOCK) - pthread_spin_destroy (&logsys_flt_spinlock); - pthread_spin_destroy (&logsys_wthread_spinlock); -#endif - return (-1); } memset (flt_data, 0, flt_real_size * 2); diff --git a/exec/main.c b/exec/main.c index 521369aa..2526a8df 100644 --- a/exec/main.c +++ b/exec/main.c @@ -148,11 +148,7 @@ static int sched_priority = 0; static unsigned int service_count = 32; -#if defined(HAVE_PTHREAD_SPIN_LOCK) -static pthread_spinlock_t serialize_spin; -#else static pthread_mutex_t serialize_mutex = PTHREAD_MUTEX_INITIALIZER; -#endif static struct totem_logging_configuration totem_logging_configuration; @@ -304,17 +300,6 @@ static struct totempg_group corosync_group = { -#if defined(HAVE_PTHREAD_SPIN_LOCK) -static void serialize_lock (void) -{ - pthread_spin_lock (&serialize_spin); -} - -static void serialize_unlock (void) -{ - pthread_spin_unlock (&serialize_spin); -} -#else static void serialize_lock (void) { pthread_mutex_lock (&serialize_mutex); @@ -324,7 +309,6 @@ static void serialize_unlock (void) { pthread_mutex_unlock (&serialize_mutex); } -#endif static void corosync_sync_completed (void) { @@ -1570,10 +1554,6 @@ int main (int argc, char **argv, char **envp) hdb_handle_t object_runtime_handle; enum e_ais_done flock_err; -#if defined(HAVE_PTHREAD_SPIN_LOCK) - pthread_spin_init (&serialize_spin, 0); -#endif - /* default configuration */ background = 1; diff --git a/exec/tsafe.c b/exec/tsafe.c index 8f3fe093..b5b0f84d 100644 --- a/exec/tsafe.c +++ b/exec/tsafe.c @@ -84,11 +84,7 @@ static void atfork_prepare (void); static void atfork_parent (void); static void atfork_child (void); -#if defined(HAVE_PTHREAD_SPIN_LOCK) -static pthread_spinlock_t tsafe_enabled_mutex; -#else static pthread_mutex_t tsafe_enabled_mutex = PTHREAD_MUTEX_INITIALIZER; -#endif void tsafe_init (char **envp) @@ -105,10 +101,6 @@ void tsafe_init (char **envp) } coro_environ[size-1] = NULL; -#if defined(HAVE_PTHREAD_SPIN_LOCK) - pthread_spin_init (&tsafe_enabled_mutex, 0); -#endif - pthread_atfork (atfork_prepare, atfork_parent, atfork_child); tsafe_disabled = 1; @@ -117,20 +109,14 @@ void tsafe_init (char **envp) static void tsafe_lock (void) { -#if defined(HAVE_PTHREAD_SPIN_LOCK) - pthread_spin_lock (&tsafe_enabled_mutex); -#else + pthread_mutex_lock (&tsafe_enabled_mutex); -#endif } static void tsafe_unlock (void) { -#if defined(HAVE_PTHREAD_SPIN_LOCK) - pthread_spin_unlock (&tsafe_enabled_mutex); -#else + pthread_mutex_unlock (&tsafe_enabled_mutex); -#endif } void tsafe_off (void) diff --git a/include/corosync/hdb.h b/include/corosync/hdb.h index 860738fe..88742f9e 100644 --- a/include/corosync/hdb.h +++ b/include/corosync/hdb.h @@ -74,35 +74,10 @@ struct hdb_handle_database { struct hdb_handle *handles; unsigned int iterator; void (*destructor) (void *); -#if defined(HAVE_PTHREAD_SPIN_LOCK) - pthread_spinlock_t lock; -#else pthread_mutex_t lock; -#endif unsigned int first_run; }; -#if defined(HAVE_PTHREAD_SPIN_LOCK) -static inline void hdb_database_lock (pthread_spinlock_t *spinlock) -{ - pthread_spin_lock (spinlock); -} - -static inline void hdb_database_unlock (pthread_spinlock_t *spinlock) -{ - pthread_spin_unlock (spinlock); -} -static inline void hdb_database_lock_init (pthread_spinlock_t *spinlock) -{ - pthread_spin_init (spinlock, 0); -} - -static inline void hdb_database_lock_destroy (pthread_spinlock_t *spinlock) -{ - pthread_spin_destroy (spinlock); -} - -#else static inline void hdb_database_lock (pthread_mutex_t *mutex) { pthread_mutex_lock (mutex); @@ -121,7 +96,6 @@ static inline void hdb_database_lock_destroy (pthread_mutex_t *mutex) { pthread_mutex_destroy (mutex); } -#endif #define DECLARE_HDB_DATABASE(database_name,destructor_function) \ static struct hdb_handle_database (database_name) = { \