diff options
author | Gleb Popov <6yearold@gmail.com> | 2020-10-08 23:07:10 +0400 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-10-12 08:57:41 +0200 |
commit | b47a8eda6ecd2b508054a68b4879c769cce87363 (patch) | |
tree | 3f3d2bb165ded9ecd6c95a00c3e06e26ff45305f /sal/osl | |
parent | 67edb62a88f331d93ba3aa0741bd4ef734d56062 (diff) |
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.Mehrbrodt@cib.de>
Diffstat (limited to 'sal/osl')
-rw-r--r-- | sal/osl/unx/thread.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
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 ); |