opnsense-ports/astro/libosmium/files/patch-include_osmium_thread_util.hpp
Franco Fichtner 130d46cc0c */*: sync with upstream
Taken from: FreeBSD
2022-03-17 14:33:31 +01:00

29 lines
863 B
C++

--- include/osmium/thread/util.hpp.orig 2022-02-07 12:59:17 UTC
+++ include/osmium/thread/util.hpp
@@ -38,8 +38,10 @@ DEALINGS IN THE SOFTWARE.
#include <thread>
#include <utility>
-#ifdef __linux__
+#if defined(__linux__)
# include <sys/prctl.h>
+#elif defined(__FreeBSD__)
+# include <pthread.h>
#endif
namespace osmium {
@@ -72,9 +74,13 @@ namespace osmium {
/**
* Set name of current thread for debugging. This only works on Linux.
*/
-#ifdef __linux__
+#if defined(__linux__)
inline void set_thread_name(const char* name) noexcept {
prctl(PR_SET_NAME, name, 0, 0, 0);
+ }
+#elif defined(__FreeBSD__)
+ inline void set_thread_name(const char* name) noexcept {
+ pthread_setname_np(pthread_self(), name);
}
#else
inline void set_thread_name(const char*) noexcept {