[mythtv] Tickets 5832, 5403, 5367, 4645

Gareth Glaccum gareth.glaccum at btopenworld.com
Sat Jan 31 00:09:36 UTC 2009


Hi, 
I am not sure of the best way of submitting patches etc. 
could I propose the following small patch for the tickets 5832, 5403, 5367, 4645?

This bug has been annoying me for a while, I always thought it was my hardware, and couldn't be bothered to fix it because it was a rare occurance for me to bother running mythtv-setup. 

However I read an email the other day which suggests taskset as a work-around. 
It is simple to implement that in mythtv itself, I think.

I know that the code that is segfaulting is in flux anyway, but with such an easy fix, could we apply the following (and suggest for -fixes, seeing as that will not have the new scan code implemented)? 
This code basically performs the same as taskset 0, and should be benign on single CPU systems (I don't have a single CPU to test on sorry, this is a 'worksforme')
Thanks, 
Gareth

*** main.cpp      2009-01-30 23:50:42.000000000 +0000
--- main.cpp    2009-01-30 23:59:17.000000000 +0000
***************
*** 16,21 ****
--- 16,23 ----

  #include <iostream>

+ #include <sched.h>
+
  #include "libmyth/mythconfig.h"
  #include "libmyth/mythcontext.h"
  #include "libmyth/mythdbcon.h"
*************** void SetupMenu(MythMainWindow *win)
*** 100,105 ****
--- 102,115 ----
  int main(int argc, char *argv[])
  {

+     //  This hack should make taskset uneccassary for multi-processor/core systems
+     pid_t mypid=getpid();
+     cpu_set_t cpuset;
+     CPU_SET(0,&cpuset);
+     unsigned int cpusetsize=sizeof(cpuset);
+     int setreturn = sched_setaffinity(mypid, cpusetsize, &cpuset);
+     // We should I suppose check what setreturn is set to, but are we going to do any different? There is no bail-out clause
+
      QString geometry = QString::null;
      QString display  = QString::null;
      QString verboseString = QString(" important general");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mythtv.org/pipermail/mythtv-dev/attachments/20090131/767a185d/attachment.htm>


More information about the mythtv-dev mailing list