gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet-fuse] 12/12: mutex: pthread_np is not widespread on *BSD. FreeBS


From: gnunet
Subject: [gnunet-fuse] 12/12: 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.
Date: Wed, 20 Nov 2019 00:00:52 +0100

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository gnunet-fuse.

commit b264f99648c52ef3e597f77417fde5c468858bb4
Author: ng0 <address@hidden>
AuthorDate: Tue Nov 19 22:52:32 2019 +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.
---
 src/fuse/mutex.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/fuse/mutex.c b/src/fuse/mutex.c
index 24c7036..55078fd 100644
--- 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);
   }
 }

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]