Minor tweaks so the code now works with only 1 thread successfully

This commit is contained in:
Arthur Moore 2015-03-12 19:31:56 -04:00
parent 70a0190a32
commit 5b00ea2b3d
2 changed files with 4 additions and 6 deletions

View File

@ -2804,10 +2804,8 @@ bool MainFrame::InitMore(void)
getcbb("VSync", gopts.vsync);
// FIXME: make cb disabled when not GL or d3d
int mthr = wxThread::GetCPUCount();
if(mthr > 8)
mthr = 8;
if(mthr < 0)
mthr = 2;
if(mthr < 1 )
mthr = 1;
cb=SafeXRCCTRL<wxCheckBox>(d, "Multithread");
cb->SetValidator(wxBoolIntValidator(&gopts.max_threads, mthr));
if(mthr <= 1)

View File

@ -1083,7 +1083,7 @@ DrawingPanel::DrawingPanel(int _width, int _height) :
// Create and start up new threads
nthreads = gopts.max_threads;
if(nthreads > 1) {
if(nthreads) {
threads = new FilterThread[nthreads];
for(int i = 0; i < nthreads; i++) {
threads[i].threadno = i;
@ -1133,7 +1133,7 @@ void DrawingPanel::DrawArea(u8 **data)
int horiz_bytes_out = width * bytes_per_pixel * scale;
// First, apply filters, if applicable, in parallel, if enabled
if(myFilter->exists() || iFilter->exists() )
if(nthreads)
{
for(int i = 0; i < nthreads; i++) {
threads[i].lock.Lock();