UI: fix build on older FreeBSD versions

Include pthread_np.h header and use pthread_set_name_np to fix build
on FreeBSD 12.1.  The Linux-compatible pthread_setname_np alias was
added later.
This commit is contained in:
Ed Maste 2020-11-15 15:54:59 -05:00 committed by Jim
parent 6d181d97ca
commit a0f64a6017

View File

@ -41,6 +41,7 @@
#include <sys/sysctl.h>
#include <sys/user.h>
#include <libprocstat.h>
#include <pthread_np.h>
#include <condition_variable>
#include <mutex>
@ -114,7 +115,7 @@ struct RunOnce {
void thr_proc()
{
std::unique_lock<std::mutex> lk(mtx);
pthread_setname_np(pthread_self(), thr_name);
pthread_set_name_np(pthread_self(), thr_name);
name_changed = true;
wait_cv.notify_all();
cv.wait(lk, [this]() { return exiting; });