Bug fixes for Qt timing priority configs.

This commit is contained in:
Matthew Budd 2020-11-28 20:43:34 -05:00
parent 18e9dc1a9e
commit 961aa83a51
3 changed files with 23 additions and 8 deletions

View File

@ -1877,6 +1877,7 @@ int consoleWin_t::getSchedParam( int &policy, int &priority )
if ( sched_getparam( getpid(), &p ) ) if ( sched_getparam( getpid(), &p ) )
{ {
perror("GUI thread sched_getparam error: ");
ret = -1; ret = -1;
priority = 0; priority = 0;
} }
@ -1892,6 +1893,11 @@ int consoleWin_t::getSchedParam( int &policy, int &priority )
{ {
perror("GUI thread pthread_getschedparam error: "); perror("GUI thread pthread_getschedparam error: ");
ret = -1; ret = -1;
priority = 0;
}
else
{
priority = p.sched_priority;
} }
#endif #endif
return ret; return ret;
@ -2193,6 +2199,8 @@ int emulatorThread_t::getSchedParam( int &policy, int &priority )
perror("Emulator thread pthread_getschedparam error: "); perror("Emulator thread pthread_getschedparam error: ");
return -1; return -1;
} }
priority = p.sched_priority;
return 0; return 0;
} }

View File

@ -60,7 +60,7 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
: QDialog( parent ) : QDialog( parent )
{ {
int opt; int opt;
QVBoxLayout *mainLayout, *vbox; QVBoxLayout *mainLayout;
//QHBoxLayout *hbox; //QHBoxLayout *hbox;
QGridLayout *grid; QGridLayout *grid;
QGroupBox *emuPrioBox, *guiPrioBox; QGroupBox *emuPrioBox, *guiPrioBox;
@ -140,6 +140,7 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
TimingConfDialog_t::~TimingConfDialog_t(void) TimingConfDialog_t::~TimingConfDialog_t(void)
{ {
printf("Destroy Timing Config Window\n"); printf("Destroy Timing Config Window\n");
saveValues();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TimingConfDialog_t::closeEvent(QCloseEvent *event) void TimingConfDialog_t::closeEvent(QCloseEvent *event)
@ -148,7 +149,6 @@ void TimingConfDialog_t::closeEvent(QCloseEvent *event)
done(0); done(0);
deleteLater(); deleteLater();
event->accept(); event->accept();
saveValues();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TimingConfDialog_t::closeWindow(void) void TimingConfDialog_t::closeWindow(void)
@ -156,7 +156,6 @@ void TimingConfDialog_t::closeWindow(void)
//printf("Close Window\n"); //printf("Close Window\n");
done(0); done(0);
deleteLater(); deleteLater();
saveValues();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TimingConfDialog_t::emuSchedCtlChange( int state ) void TimingConfDialog_t::emuSchedCtlChange( int state )
@ -166,23 +165,31 @@ void TimingConfDialog_t::emuSchedCtlChange( int state )
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TimingConfDialog_t::saveValues(void) void TimingConfDialog_t::saveValues(void)
{ {
int policy, prio; int policy, prio, nice;
if ( consoleWindow == NULL ) if ( consoleWindow == NULL )
{ {
return; return;
} }
nice = consoleWindow->emulatorThread->getNicePriority();
consoleWindow->emulatorThread->getSchedParam( policy, prio ); consoleWindow->emulatorThread->getSchedParam( policy, prio );
g_config->setOption( "SDL.EmuSchedPolicy", policy ); g_config->setOption( "SDL.EmuSchedPolicy", policy );
g_config->setOption( "SDL.EmuSchedPrioRt", prio ); g_config->setOption( "SDL.EmuSchedPrioRt", prio );
g_config->setOption( "SDL.EmuSchedNice" , consoleWindow->emulatorThread->getNicePriority() ); g_config->setOption( "SDL.EmuSchedNice" , nice );
//printf("EMU Sched: %i %i %i\n", policy, prio, nice );
nice = consoleWindow->getNicePriority();
consoleWindow->getSchedParam( policy, prio ); consoleWindow->getSchedParam( policy, prio );
g_config->setOption( "SDL.GuiSchedPolicy", policy ); g_config->setOption( "SDL.GuiSchedPolicy", policy );
g_config->setOption( "SDL.GuiSchedPrioRt", prio ); g_config->setOption( "SDL.GuiSchedPrioRt", prio );
g_config->setOption( "SDL.GuiSchedNice" , consoleWindow->getNicePriority() ); g_config->setOption( "SDL.GuiSchedNice" , nice );
//printf("GUI Sched: %i %i %i\n", policy, prio, nice );
g_config->save(); g_config->save();
} }