X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=gnuradio-core%2Fsrc%2Flib%2Fruntime%2Fgr_realtime.cc;h=b44c4d408cd280c0c4b8a43f7b70b7e60ad53a5a;hb=ea29b08aeb54227e6628f655ccfdb96fe4d8c378;hp=878411df296bb1291dcc3baf8f8a242c5af5df5f;hpb=09a1e803a9e6587c78d20cdf16891e5295874668;p=debian%2Fgnuradio diff --git a/gnuradio-core/src/lib/runtime/gr_realtime.cc b/gnuradio-core/src/lib/runtime/gr_realtime.cc index 878411df..b44c4d40 100644 --- a/gnuradio-core/src/lib/runtime/gr_realtime.cc +++ b/gnuradio-core/src/lib/runtime/gr_realtime.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2007,2008 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -25,47 +25,8 @@ #endif #include -#ifdef HAVE_SCHED_H -#include -#endif - -#include -#include -#include - -#if defined(HAVE_SCHED_SETSCHEDULER) - -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; - int pid = 0; // this process - - struct sched_param param; - memset(¶m, 0, sizeof(param)); - param.sched_priority = pri; - int result = sched_setscheduler(pid, policy, ¶m); - if (result != 0){ - if (errno == EPERM) - return RT_NO_PRIVS; - else { - perror ("sched_setscheduler: 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 - gr_rt_status_t gr_enable_realtime_scheduling() { - return RT_NOT_IMPLEMENTED; + return gruel::enable_realtime_scheduling(); } - -#endif