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:
parent
6d181d97ca
commit
a0f64a6017
@ -41,6 +41,7 @@
|
|||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <sys/user.h>
|
#include <sys/user.h>
|
||||||
#include <libprocstat.h>
|
#include <libprocstat.h>
|
||||||
|
#include <pthread_np.h>
|
||||||
|
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
@ -114,7 +115,7 @@ struct RunOnce {
|
|||||||
void thr_proc()
|
void thr_proc()
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lk(mtx);
|
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;
|
name_changed = true;
|
||||||
wait_cv.notify_all();
|
wait_cv.notify_all();
|
||||||
cv.wait(lk, [this]() { return exiting; });
|
cv.wait(lk, [this]() { return exiting; });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user