Skip to content

Commit

Permalink
Merge pull request #558 from nightrune/sms-windows-fixes
Browse files Browse the repository at this point in the history
Small fixes for windows
  • Loading branch information
peternewman committed Dec 10, 2014
2 parents 0342478 + 83d40f1 commit 2779984
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 6 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 @@ -137,6 +139,7 @@ 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,6 +216,9 @@ void ThreadTest::testSchedulingOptions() {
OLA_ASSERT_EQ(override_params.priority,
thread.GetSchedulingParams().priority);
}
#else
OLA_WARN << "Scheduling options are not supported on windows..";
#endif // #ifndef _WIN32
}

class MockConditionThread: public Thread {
Expand Down
9 changes: 7 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,8 +46,12 @@ 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;
Expand Down

0 comments on commit 2779984

Please sign in to comment.