diff options
author | Josh Blum <josh@joshknows.com> | 2011-02-21 19:03:13 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-02-21 19:03:13 -0800 |
commit | a8bb5ec900d8f2d3d2f274a921d19b564c668323 (patch) | |
tree | a3f87f539a8ff641cd6580c0ea28d38adcd0b057 /host/lib/utils/thread_priority.cpp | |
parent | a7f9529f77700309dbaaa6250f6bd775bab7a70d (diff) | |
download | uhd-a8bb5ec900d8f2d3d2f274a921d19b564c668323.tar.gz uhd-a8bb5ec900d8f2d3d2f274a921d19b564c668323.tar.bz2 uhd-a8bb5ec900d8f2d3d2f274a921d19b564c668323.zip |
uhd: replace header checks in cmake files with more robust compile checks for features
implemented different ifdefs in the cpp files
Diffstat (limited to 'host/lib/utils/thread_priority.cpp')
-rw-r--r-- | host/lib/utils/thread_priority.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/host/lib/utils/thread_priority.cpp b/host/lib/utils/thread_priority.cpp index 40b74f655..18f372ec0 100644 --- a/host/lib/utils/thread_priority.cpp +++ b/host/lib/utils/thread_priority.cpp @@ -44,7 +44,7 @@ static void check_priority_range(float priority){ /*********************************************************************** * Pthread API to set priority **********************************************************************/ -#if defined(HAVE_PTHREAD_SETSCHEDPARAM) +#ifdef HAVE_PTHREAD_SETSCHEDPARAM #include <pthread.h> void uhd::set_thread_priority(float priority, bool realtime){ @@ -67,11 +67,12 @@ static void check_priority_range(float priority){ int ret = pthread_setschedparam(pthread_self(), policy, &sp); if (ret != 0) throw std::runtime_error("error in pthread_setschedparam"); } +#endif /* HAVE_PTHREAD_SETSCHEDPARAM */ /*********************************************************************** * Windows API to set priority **********************************************************************/ -#elif defined(HAVE_WIN_SETTHREADPRIORITY) +#ifdef HAVE_WIN_SETTHREADPRIORITY #include <windows.h> void uhd::set_thread_priority(float priority, bool realtime){ @@ -93,13 +94,14 @@ static void check_priority_range(float priority){ if (SetThreadPriority(GetCurrentThread(), priorities[pri_index]) == 0) throw std::runtime_error("error in SetThreadPriority"); } +#endif /* HAVE_WIN_SETTHREADPRIORITY */ /*********************************************************************** * Unimplemented API to set priority **********************************************************************/ -#else +#ifdef HAVE_LOAD_MODULES_DUMMY void uhd::set_thread_priority(float, bool){ throw std::runtime_error("set thread priority not implemented"); } -#endif /* HAVE_PTHREAD_SETSCHEDPARAM */ +#endif /* HAVE_LOAD_MODULES_DUMMY */ |