Permalink
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...
1 parent eb5495d commit df79bbbcb701043d9c401b0248f98264223503ae @hzeller committed Oct 11, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 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;
}

0 comments on commit df79bbb

Please sign in to comment.