diff --git a/.gitignore b/.gitignore index 8d5a11a05..d21ebf252 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,8 @@ callgrind.* shadow.data shadow.config.xml *.log +*.pdf +*.xz testnet_tmp diff --git a/llarp/util/threading.cpp b/llarp/util/threading.cpp index f136fabc1..9015d99f4 100644 --- a/llarp/util/threading.cpp +++ b/llarp/util/threading.cpp @@ -4,7 +4,7 @@ #ifdef POSIX #include -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) #include #endif #endif @@ -17,18 +17,23 @@ namespace llarp SetThreadName(const std::string& name) { #ifdef POSIX -#ifdef __MACH__ - const int rc = pthread_setname_np(name.c_str()); -#elif defined(__FreeBSD__) - const int rc = pthread_setname_np(pthread_self(), name.c_str(), nullptr); +#if defined(__FreeBSD__) + /* on free bsd this function has void return type */ + pthread_set_name_np(pthread_self(), name.c_str(); #else +#if defined(__MACH__) + const int rc = pthread_setname_np(name.c_str()); +#elif defined(__linux__) const int rc = pthread_setname_np(pthread_self(), name.c_str()); +#else +#error "unsupported platform" #endif if(rc) { LogError("Failed to set thread name to ", name, " errno = ", rc, " errstr = ", strerror(rc)); } +#endif #else LogInfo("Thread name setting not supported on this platform"); (void)name;