Quellcode durchsuchen

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.
Ed Maste vor 5 Jahren
Ursprung
Commit
a0f64a6017
1 geänderte Dateien mit 2 neuen und 1 gelöschten Zeilen
  1. 2 1
      UI/platform-x11.cpp

+ 2 - 1
UI/platform-x11.cpp

@@ -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; });