X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fthreadrecon.cpp;fp=src%2Fthreadrecon.cpp;h=0ec059bbcb2293be950c8731d8b29878deafe068;hp=4ece6ed3e0f03b784ce34315976c16c2b1c62122;hb=cd93aebb4dec4e0ae88d53f131c2320ae92d0cab;hpb=e98a8a9d72a7b919debbbc9d1b0f237fe71c0fb3 diff --git a/src/threadrecon.cpp b/src/threadrecon.cpp index 4ece6ed..0ec059b 100644 --- a/src/threadrecon.cpp +++ b/src/threadrecon.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2001 Kevin Rosenberg ** -** $Id: threadrecon.cpp,v 1.19 2001/03/04 04:30:45 kevin Exp $ +** $Id: threadrecon.cpp,v 1.20 2001/03/04 22:30:20 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -70,9 +70,8 @@ ReconstructorSupervisorThread::Entry() m_strInterpName.c_str(), m_iInterpParam, m_strBackprojectName.c_str(), m_strLabel.c_str()); reconSupervisor.start(); - while (! reconSupervisor.isDone() && ! reconSupervisor.fail()) { + while (! reconSupervisor.workersDone() && ! reconSupervisor.fail() && ! reconSupervisor.cancelled()) { Sleep(100); - Yield(); } if (reconSupervisor.fail()) { @@ -83,10 +82,12 @@ ReconstructorSupervisorThread::Entry() eventLog.SetString( msg ); wxPostEvent( theApp->getMainFrame(), eventLog ); // send log event } + if (! reconSupervisor.cancelled()) + reconSupervisor.onDone(); + reconSupervisor.deleteWorkers(); while (! reconSupervisor.workersDeleted()) { Sleep(50); - reconSupervisor.ProcessPendingEvents(); } return reinterpret_cast(0); @@ -216,12 +217,12 @@ ReconstructorWorker::Entry () m_pszFilterGenerationName, m_pszInterpName, m_iInterpParam, m_pszBackprojectName, Trace::TRACE_NONE); bool bFail = pReconstructor->fail(); - wxString failMsg; + std::string failMsg; if (bFail) { failMsg = "Unable to make reconstructor: "; failMsg += pReconstructor->failMessage().c_str(); wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT ); - event.SetString( failMsg ); + event.SetString( failMsg.c_str() ); wxPostEvent( theApp->getMainFrame(), event ); } else @@ -241,21 +242,16 @@ ReconstructorWorker::Entry () break; } pReconstructor->reconstructView (iUnit + m_iStartUnit, 1); - m_pSupervisor->AddPendingEvent (eventProgress); + m_pSupervisor->onWorkerUnitTick(); } pReconstructor->postProcessing(); } delete pReconstructor; if (bFail) { - wxCommandEvent eventFail (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_WORKER_THREAD_FAIL); - eventFail.SetInt (m_iThread); // Send back thread# that has finished - eventFail.SetString (failMsg); - wxPostEvent (m_pSupervisor, eventFail); + m_pSupervisor->onWorkerFail (m_iThread, failMsg); } else { - wxCommandEvent eventDone (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_WORKER_THREAD_DONE); - eventDone.SetInt (m_iThread); // Send back thread# that has finished - wxPostEvent (m_pSupervisor, eventDone); + m_pSupervisor->onWorkerDone (m_iThread); } while (! TestDestroy())