Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

o Looks like we explicitly need to include linux/sched.h on some syst…

…ems.

o Only set scheduling priority if it is available on that system.
  • Loading branch information...
commit df79bbbcb701043d9c401b0248f98264223503ae 1 parent eb5495d
Henner Zeller authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 util.cc
6 util.cc
View
@@ -17,6 +17,8 @@
#include "util.h"
+#include <linux/sched.h> // for SCHED_IDLE, <sched.h> doesn't do it everywhere
+
#include <assert.h>
#include <stdio.h>
#include <sys/time.h>
@@ -97,9 +99,13 @@ folve::Thread::~Thread() {
void folve::Thread::Start() {
assert(!started_);
pthread_create(&thread_, NULL, &PthreadCallRun, this);
+
+#ifdef SCHED_IDLE
// Background thread:
struct sched_param p;
p.sched_priority = 0;
pthread_setschedparam(thread_, SCHED_IDLE, &p);
+#endif
+
started_ = true;
}
Please sign in to comment.
Something went wrong with that request. Please try again.