aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/CMakeLists.txt
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-06-19 01:31:40 +0000
committerJosh Blum <josh@joshknows.com>2010-06-19 01:31:40 +0000
commita9319441d688620e18d5621cc59b98769e670468 (patch)
tree834918c47d69808ca163746788c7a1e0a14462aa /host/lib/CMakeLists.txt
parent2f9b6d5530df140a5a03120adc98a5ad32a69cc4 (diff)
parent1c1d967ec73906d50ee6e7257a4153db4ab9c507 (diff)
downloaduhd-a9319441d688620e18d5621cc59b98769e670468.tar.gz
uhd-a9319441d688620e18d5621cc59b98769e670468.tar.bz2
uhd-a9319441d688620e18d5621cc59b98769e670468.zip
Merge branch 'master' of ettus.sourcerepo.com:ettus/uhdpriv into usrp_e
Diffstat (limited to 'host/lib/CMakeLists.txt')
-rw-r--r--host/lib/CMakeLists.txt41
1 files changed, 31 insertions, 10 deletions
diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt
index 26d275845..77b04af0c 100644
--- a/host/lib/CMakeLists.txt
+++ b/host/lib/CMakeLists.txt
@@ -77,17 +77,38 @@ INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/usrp/usrp_e/CMakeLists.txt)
########################################################################
# Setup defines for process scheduling
########################################################################
-MESSAGE(STATUS "Configuring process scheduling...")
+MESSAGE(STATUS "Configuring priority scheduling...")
+
+INCLUDE(CheckCXXSourceCompiles)
+CHECK_CXX_SOURCE_COMPILES("
+ #include <pthread.h>
+ int main(){
+ struct sched_param sp;
+ pthread_setschedparam(pthread_self(), SCHED_RR, &sp);
+ return 0;
+ }
+ " HAVE_PTHREAD_SETSCHEDPARAM
+)
-INCLUDE(CheckIncludeFileCXX)
-CHECK_INCLUDE_FILE_CXX(sched.h HAVE_SCHED_H)
+CHECK_CXX_SOURCE_COMPILES("
+ #include <windows.h>
+ int main(){
+ SetThreadPriority(GetCurrentThread(), 0);
+ SetPriorityClass(GetCurrentProcess(), 0);
+ return 0;
+ }
+ " HAVE_WIN_SETTHREADPRIORITY
+)
-IF(HAVE_SCHED_H)
- MESSAGE(STATUS " Process scheduling supported through sched_setscheduler.")
- ADD_DEFINITIONS(-DHAVE_SCHED_H)
-ELSE(HAVE_SCHED_H)
- MESSAGE(STATUS " Process scheduling not supported.")
-ENDIF(HAVE_SCHED_H)
+IF(HAVE_PTHREAD_SETSCHEDPARAM)
+ MESSAGE(STATUS " Priority scheduling supported through pthread_setschedparam.")
+ ADD_DEFINITIONS(-DHAVE_PTHREAD_SETSCHEDPARAM)
+ELSEIF(HAVE_WIN_SETTHREADPRIORITY)
+ MESSAGE(STATUS " Priority scheduling supported through windows SetThreadPriority.")
+ ADD_DEFINITIONS(-DHAVE_WIN_SETTHREADPRIORITY)
+ELSE(HAVE_PTHREAD_SETSCHEDPARAM)
+ MESSAGE(STATUS " Priority scheduling not supported.")
+ENDIF(HAVE_PTHREAD_SETSCHEDPARAM)
########################################################################
# Setup defines for module loading
@@ -115,7 +136,7 @@ LIBUHD_APPEND_SOURCES(
${CMAKE_CURRENT_SOURCE_DIR}/device.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gain_handler.cpp
${CMAKE_CURRENT_SOURCE_DIR}/load_modules.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/sched.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/thread_priority.cpp
${CMAKE_CURRENT_SOURCE_DIR}/types.cpp
${CMAKE_CURRENT_SOURCE_DIR}/utils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wax.cpp