sal/osl/unx/thread.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit b47a8eda6ecd2b508054a68b4879c769cce87363
Author:     Gleb Popov <6year...@gmail.com>
AuthorDate: Thu Oct 8 23:07:10 2020 +0400
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
CommitDate: Mon Oct 12 08:57:41 2020 +0200

    Use `pthread_set_name_np` on FreeBSD 12.1 and below, as 
`pthread_setname_np` isn't available there.
    
    While here, change the #ifdef check from __FreeBSD_kernel_ to __FreeBSD__, 
because pthreads API is userspace (read, belongs to libc).
    
    Change-Id: I83e76b5502a6dfa1be5d3598eb1367f25815396e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104098
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>

diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx
index 2472efec8618..ce5ece7c1d59 100644
--- a/sal/osl/unx/thread.cxx
+++ b/sal/osl/unx/thread.cxx
@@ -30,6 +30,12 @@
 #if defined(OPENBSD)
 #include <sched.h>
 #endif
+#ifdef __FreeBSD__
+#if __FreeBSD_version <= 1201517
+#include <pthread_np.h>
+#define pthread_setname_np pthread_set_name_np
+#endif
+#endif
 #include <config_options.h>
 #include <o3tl/safeint.hxx>
 #include <osl/thread.h>
@@ -567,7 +573,7 @@ void SAL_CALL osl_setThreadName(char const * name)
     int err = pthread_setname_np( pthread_self(), shortname );
     if ( 0 != err )
         SAL_WARN("sal.osl", "pthread_setname_np failed with errno " << err);
-#elif defined __FreeBSD_kernel__
+#elif defined __FreeBSD__
     pthread_setname_np( pthread_self(), name );
 #elif defined MACOSX || defined IOS
     pthread_setname_np( name );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to