--------------------Configuration: ctsim - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP247.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP25B.tmp" with contents
[
/nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "\wx2.2.5\include" /I "..\..\..\fftw-2.1.3\fftw" /I "\wx2.2.5\src\png" /I "\wx2.2.5\src\zlib" /I "..\..\include" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\rfftw" /D VERSION=\"3.0.0beta1\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"3.0.4\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
-"C:\ctsim\src\threadrecon.cpp"
+"C:\ctsim\src\backgroundsupr.cpp"
]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP247.tmp"
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP248.tmp" with contents
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP25B.tmp"
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP25C.tmp" with contents
[
winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib wxd.lib xpmd.lib tiffd.lib zlibd.lib pngd.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib htmlhelp.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"\wx2.2.5\lib"
.\Debug\backgroundmgr.obj
\wx2.2.5\lib\zlibd.lib
\wx2.2.5\lib\tiffd.lib
]
-Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP248.tmp"
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP25C.tmp"
<h3>Output Window</h3>
Compiling...
-threadrecon.cpp
+backgroundsupr.cpp
Linking...
** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: backgroundsupr.cpp,v 1.2 2001/02/25 07:36:26 kevin Exp $
+** $Id: backgroundsupr.cpp,v 1.3 2001/02/25 08:00:57 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
BackgroundSupervisor::~BackgroundSupervisor()
{
+ for (int i = 0; i < m_iNumThreads; i++)
+ if (m_vecpThreads[i]) {
+ m_vecpThreads[i]->Delete(); // sends Destroy message to workers
+ }
+
+ while (m_iRunning > 0) {
+ Sleep(50);
+ ProcessPendingEvents();
+ }
+
if (m_bBackgroundTaskAdded) {
wxCommandEvent doneEvent (wxEVT_COMMAND_MENU_SELECTED, MSG_BACKGROUND_SUPERVISOR_REMOVE);
doneEvent.SetClientData (this);
delete m_pDialogProgress;
}
-void
-BackgroundSupervisor::deleteAnyWorkers()
-{
- m_critsectThreadContainer.Enter();
- for (int i = 0; i < m_iNumThreads; i++)
- if (m_vecpThreads[i]) {
- m_vecpThreads[i]->Delete(); // sends Destroy message to workers
- }
- m_critsectThreadContainer.Leave();
-
- while (m_iRunning > 0) {
- Sleep(50);
- ProcessPendingEvents();
- }
-}
-
-
bool
BackgroundSupervisor::start()
{
BackgroundSupervisor::OnCancel(wxCommandEvent& event)
{
m_bCancelled = true;
- deleteAnyWorkers();
m_bDone = true;
}
{
m_iRunning--;
wxASSERT (m_iRunning >= 0);
- m_critsectThreadContainer.Enter();
- m_vecpThreads[event.GetInt()] = NULL;
- m_critsectThreadContainer.Leave();
#ifdef DEBUG
if (theApp->getVerboseLogging()) {
BackgroundSupervisor::OnWorkerFail (wxCommandEvent& event)
{
m_iRunning--;
- m_critsectThreadContainer.Enter();
- m_vecpThreads[event.GetInt()] = NULL;
- m_critsectThreadContainer.Leave();
wxCommandEvent eventLog( wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT );
eventLog.SetString( event.GetString() );
wxPostEvent( theApp->getMainFrame(), eventLog ); // send log event
- onDone();
+ wxCommandEvent dummy;
+ OnCancel(dummy);
}
** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: backgroundsupr.h,v 1.1 2001/02/25 06:32:12 kevin Exp $
+** $Id: backgroundsupr.h,v 1.2 2001/02/25 08:00:57 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
typedef std::vector<BackgroundWorkerThread*> ThreadContainer;
ThreadContainer m_vecpThreads;
- wxCriticalSection m_critsectThreadContainer;
wxFrame* m_pParentFrame;
wxDocument* m_pDocument;
const std::string m_strProcessTitle;
{ return NULL; }
bool start();
- void deleteAnyWorkers();
virtual void onDone() {};
virtual void OnWorkerFail(wxCommandEvent& event);
** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: threadrecon.cpp,v 1.9 2001/02/25 07:36:26 kevin Exp $
+** $Id: threadrecon.cpp,v 1.10 2001/02/25 08:00:57 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
*m_pImageFile, m_pszFilterName, m_dFilterParam, m_pszFilterMethod, m_iZeropad,
m_pszFilterGenerationName, m_pszInterpName, m_iInterpParam, m_pszBackprojectName, Trace::TRACE_NONE);
- wxCommandEvent eventDone (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_WORKER_THREAD_DONE);
- eventDone.SetInt (m_iThread); // Send back thread# that has finished
-
- if (pReconstructor->fail()) {
- wxString msg("Unable to make reconstructor: ");
- msg += pReconstructor->failMessage().c_str();
+ bool bFail = pReconstructor->fail();
+ wxString failMsg;
+ if (bFail) {
+ failMsg = "Unable to make reconstructor: ";
+ failMsg += pReconstructor->failMessage().c_str();
wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT );
- event.SetString( msg );
+ event.SetString( failMsg );
wxPostEvent( theApp->getMainFrame(), event );
-
- wxPostEvent (m_pSupervisor, eventDone);
- return reinterpret_cast<wxThread::ExitCode>(-1);
}
-
- wxCommandEvent eventProgress (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_WORKER_THREAD_UNIT_TICK);
-
- for (int iUnit = 0; iUnit < m_iNumUnits; iUnit++) {
- if (TestDestroy()) {
+ else
+ {
+ wxCommandEvent eventProgress (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_WORKER_THREAD_UNIT_TICK);
+ for (int iUnit = 0; iUnit < m_iNumUnits; iUnit++) {
+ if (TestDestroy()) {
#ifdef DEBUG
- if (theApp->getVerboseLogging()) {
- wxString msg;
- msg.Printf("Worker thread: Received destroy message at work unit #%d\n", iUnit);
- wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT );
- event.SetString( msg );
- wxPostEvent( theApp->getMainFrame(), event );
- }
+ if (theApp->getVerboseLogging()) {
+ wxString msg;
+ msg.Printf("Worker thread: Received destroy message at work unit #%d\n", iUnit);
+ wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT );
+ event.SetString( msg );
+ wxPostEvent( theApp->getMainFrame(), event );
+ }
#endif
- delete pReconstructor;
- wxPostEvent (m_pSupervisor, eventDone);
-
- return reinterpret_cast<wxThread::ExitCode>(-1);
+ break;
+ }
+ pReconstructor->reconstructView (iUnit + m_iStartUnit, 1);
+ m_pSupervisor->AddPendingEvent (eventProgress);
}
- pReconstructor->reconstructView (iUnit + m_iStartUnit, 1);
- m_pSupervisor->AddPendingEvent (eventProgress);
+ pReconstructor->postProcessing();
}
- pReconstructor->postProcessing();
delete pReconstructor;
- wxPostEvent (m_pSupervisor, eventDone);
+ 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);
+ } 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);
+ }
- return reinterpret_cast<wxThread::ExitCode>(0);
+ while (! TestDestroy())
+ Sleep(100);
+
+ return reinterpret_cast<wxThread::ExitCode>(0);
}
void