commit b264f99648c52ef3e597f77417fde5c468858bb4
parent a50c5483263126e197376dc5bed3d4a6f570c08a
Author: ng0 <ng0@n0.is>
Date: Tue, 19 Nov 2019 22:52:32 +0000
mutex: pthread_np is not widespread on *BSD. FreeBSD points out that
the functions we are using are deprecated and pthread functions should
be used instead. Since we use them for Solaris, move the BSD define to
them. We should instead turn this into an else, as listing N + 1
operating systems definitions is bad style, for now just see if this
is usable.
Furthermore assume that pthread_np exists on Linux - which seems
to be unnecessary because this was previously guarded by BSD.
Diffstat:
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/fuse/mutex.c b/src/fuse/mutex.c
@@ -26,7 +26,7 @@
#include "mutex.h"
#include <pthread.h>
-#if BSD
+#ifdef LINUX
# include <pthread_np.h>
#endif
@@ -73,10 +73,7 @@ GNUNET_mutex_create (int isRecursive)
#if LINUX
GNUNET_assert (0 == pthread_mutexattr_setkind_np
(&attr, PTHREAD_MUTEX_RECURSIVE_NP));
-#elif BSD
- GNUNET_assert (0 == pthread_mutexattr_setkind_np
- (&attr, PTHREAD_MUTEX_RECURSIVE));
-#elif SOLARIS || OSX || WINDOWS
+#elif BSD || SOLARIS || OSX || WINDOWS
GNUNET_assert (0 == pthread_mutexattr_settype
(&attr, PTHREAD_MUTEX_RECURSIVE));
#endif
@@ -110,7 +107,7 @@ GNUNET_mutex_lock (struct GNUNET_Mutex * mutex)
{
if (0 != (errno = pthread_mutex_lock (&mutex->pt)))
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "pthread_mutex_unlock");
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "pthread_mutex_unlock");
GNUNET_assert (0);
}
}
@@ -121,7 +118,7 @@ GNUNET_mutex_unlock (struct GNUNET_Mutex * mutex)
{
if (0 != (errno = pthread_mutex_unlock (&mutex->pt)))
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "pthread_mutex_unlock");
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "pthread_mutex_unlock");
GNUNET_assert (0);
}
}