Made changes, such that:
authormichaelld <michaelld@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 13 Sep 2007 20:36:23 +0000 (20:36 +0000)
committermichaelld <michaelld@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 13 Sep 2007 20:36:23 +0000 (20:36 +0000)
* trunk now passes "make distcheck" on OSX
* verified that 'realtime' scheduling now works on systems with
  'pthread_setschedparam' but not 'sched_setscheduler' (e.g. darwin);
  the latter has priority if both are installed.

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6427 221aa14e-8319-0410-a670-987f0aec2ac5

config/grc_usrp.m4
gnuradio-core/src/lib/runtime/gr_realtime.cc
gr-usrp/src/run_tests.in

index cc4f6a17607b29030dff9f6bd53c431bd0da2cd6..e28e6c28dcc5a4f540c4ff7ff37cf65930f26f23 100644 (file)
@@ -1,4 +1,4 @@
-dnl Copyright 2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+dnl Copyright 2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
 dnl 
 dnl This file is part of GNU Radio
 dnl 
@@ -54,7 +54,7 @@ AC_DEFUN([GRC_USRP],[
     # These checks don't fail
     AC_C_BIGENDIAN
     AC_CHECK_HEADERS([byteswap.h linux/compiler.h])
-    AC_CHECK_FUNCS([getrusage sched_setscheduler])
+    AC_CHECK_FUNCS([getrusage sched_setscheduler pthread_setschedparam])
     AC_CHECK_FUNCS([sigaction snprintf])
 
     passed=yes
index 878411df296bb1291dcc3baf8f8a242c5af5df5f..35d0ef38103154af50dab970d9a63797adb23d18 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2006 Free Software Foundation, Inc.
+ * Copyright 2006,2007 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -58,6 +58,33 @@ gr_enable_realtime_scheduling()
   return RT_OK;
 }
 
+#elif defined(HAVE_PTHREAD_SETSCHEDPARAM)
+
+#include <pthread.h>
+
+gr_rt_status_t
+gr_enable_realtime_scheduling()
+{
+  int policy = SCHED_FIFO;
+  int pri = (sched_get_priority_max (policy) +
+            sched_get_priority_min (policy)) / 2;
+  pthread_t this_thread = pthread_self ();  // this process
+  struct sched_param param;
+  memset (&param, 0, sizeof (param));
+  param.sched_priority = pri;
+  int result = pthread_setschedparam (this_thread, policy, &param);
+  if (result != 0) {
+    if (errno == EPERM)
+      return RT_NO_PRIVS;
+    else {
+      perror ("pthread_setschedparam: failed to set real time priority");
+      return RT_OTHER_ERROR;
+    }
+  }
+  //printf("SCHED_FIFO enabled with priority = %d\n", pri);
+  return RT_OK;
+}
+
 // #elif // could try negative niceness
 
 #else
index 49e9530cbe6a51728056446d8b52ab2cc4bd0e0d..84ae973f440191ef6d0f3b8d66f5777b7d1f347f 100644 (file)
@@ -5,11 +5,11 @@
 # 3rd parameter is path to Python QA directory
 
 # For OS/X
-DYLD_LIBRARY_PATH=@abs_top_builddir@/usrp/host/lib/:@abs_top_builddir@/usrp/host/lib/.libs:$DYLD_LIBRARY_PATH
+DYLD_LIBRARY_PATH=@abs_top_builddir@/usrp/host/lib/legacy/:@abs_top_builddir@/usrp/host/lib/legacy/.libs:$DYLD_LIBRARY_PATH
 export DYLD_LIBRARY_PATH
 
 # For Win32
-PATH=@abs_top_builddir@/usrp/host/lib/.libs:$PATH
+PATH=@abs_top_builddir@/usrp/host/lib/legacy/.libs:$PATH
 
 @top_builddir@/run_tests.sh \
     @abs_top_srcdir@/gr-usrp \