Skip to content

Commit

Permalink
Merge 80df266 into 28bf5ab
Browse files Browse the repository at this point in the history
  • Loading branch information
nightrune committed Dec 9, 2014
2 parents 28bf5ab + 80df266 commit 065434c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions common/thread/ThreadTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <cppunit/extensions/HelperMacros.h>
#include <errno.h>
#include <string.h>
#ifndef _WIN32
#include <sys/resource.h>
#endif
#include <algorithm>

#include "ola/Logging.h"
Expand Down Expand Up @@ -136,7 +138,9 @@ void ThreadTest::testThread() {
/*
* Check that the scheduling options behave as expected.
*/

void ThreadTest::testSchedulingOptions() {
#ifndef _WIN32
#if HAVE_DECL_RLIMIT_RTPRIO
struct rlimit rlim;
OLA_ASSERT_TRUE(ola::system::GetRLimit(RLIMIT_RTPRIO, &rlim));
Expand Down Expand Up @@ -213,8 +217,12 @@ void ThreadTest::testSchedulingOptions() {
OLA_ASSERT_EQ(override_params.priority,
thread.GetSchedulingParams().priority);
}
#else
OLA_INFO << "Scheduling options are not supported on windows..";
#endif // #ifndef _WIN32
}


class MockConditionThread: public Thread {
public:
MockConditionThread(
Expand Down
10 changes: 8 additions & 2 deletions common/thread/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <string.h>
#include <string>
#include "ola/Logging.h"
#include "ola/thread/Thread.h"

namespace ola {
namespace thread {
Expand All @@ -45,11 +46,16 @@ bool SetSchedParam(pthread_t thread, int policy,
const struct sched_param &param) {
int r = pthread_setschedparam(thread, policy, &param);
if (r != 0) {
OLA_FATAL << "Unable to set thread scheduling parameters for thread "
<< thread << ": " << strerror(r);
OLA_FATAL << "Unable to set thread scheduling parameters for thread: "
#ifdef _WIN32
<< thread.x << ": " << strerror(r);
#else
<< thread << ": " << strerror(r);
#endif
return false;
}
return true;
}

} // namespace thread
} // namespace ola

0 comments on commit 065434c

Please sign in to comment.