[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.
- [gnunet-fuse] 04/12: capitalize operating systems., (continued)
- [gnunet-fuse] 04/12: capitalize operating systems., gnunet, 2019/11/19
- [gnunet-fuse] 05/12: extend bootstrap script for uncrustify, gnunet, 2019/11/19
- [gnunet-fuse] 02/12: configure: remove cpp, add uncrustify check., gnunet, 2019/11/19
- [gnunet-fuse] 08/12: fix copy paste mistake., gnunet, 2019/11/19
- [gnunet-fuse] 03/12: add make pretty., gnunet, 2019/11/19
- [gnunet-fuse] 07/12: gitignore uncrustify.cfg, gnunet, 2019/11/19
- [gnunet-fuse] 06/12: add submodule, gnunet, 2019/11/19
- [gnunet-fuse] 09/12: configure: maybe make fuse detection more portable., gnunet, 2019/11/19
- [gnunet-fuse] 11/12: configure for fuse., gnunet, 2019/11/19
- [gnunet-fuse] 10/12: lint, gnunet, 2019/11/19
- [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.,
gnunet <=