r580: no message
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 25 Feb 2001 08:00:57 +0000 (08:00 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 25 Feb 2001 08:00:57 +0000 (08:00 +0000)
msvc/ctsim/ctsim.plg
src/backgroundsupr.cpp
src/backgroundsupr.h
src/threadrecon.cpp

index 02c55abf35b2a1d574bb283f3ba15595e6fb2222..249267f57862ed2679f89b4a2e7e4e747036f519 100644 (file)
@@ -6,13 +6,13 @@
 --------------------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
@@ -37,10 +37,10 @@ winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..
 \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...
 
 
index 2b8c0491cd2f034111f014d8a77d95701c750aa5..04af1d6cb858a41681bfa77f1ecd53c184636fd9 100644 (file)
@@ -9,7 +9,7 @@
 **  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
@@ -84,6 +84,16 @@ BackgroundSupervisor::BackgroundSupervisor (wxFrame* pParentFrame, wxDocument* p
 
 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);
@@ -100,23 +110,6 @@ BackgroundSupervisor::~BackgroundSupervisor()
   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()
 {
@@ -174,7 +167,6 @@ void
 BackgroundSupervisor::OnCancel(wxCommandEvent& event)
 {
   m_bCancelled = true;
-  deleteAnyWorkers();
   m_bDone = true;
 }
 
@@ -212,9 +204,6 @@ BackgroundSupervisor::OnWorkerDone (wxCommandEvent& event)
 {
   m_iRunning--;
   wxASSERT (m_iRunning >= 0);
-  m_critsectThreadContainer.Enter();
-  m_vecpThreads[event.GetInt()] = NULL;
-  m_critsectThreadContainer.Leave();
 
 #ifdef DEBUG
   if (theApp->getVerboseLogging()) {
@@ -233,13 +222,11 @@ void
 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);
 }
 
index faae6e0c60b2d8b0ea09190d3cdc6811d2160514..9058c597f6efb1bf8bcbc5d6171e6f2e98683b89 100644 (file)
@@ -9,7 +9,7 @@
 **  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
@@ -56,7 +56,6 @@ private:
 
   typedef std::vector<BackgroundWorkerThread*> ThreadContainer;
   ThreadContainer m_vecpThreads;
-  wxCriticalSection m_critsectThreadContainer;
   wxFrame* m_pParentFrame;
   wxDocument* m_pDocument;
   const std::string m_strProcessTitle;
@@ -99,7 +98,6 @@ public:
   { return NULL; }
 
   bool start();
-  void deleteAnyWorkers();
   virtual void onDone() {};
   
   virtual void OnWorkerFail(wxCommandEvent& event);
index 820b44b75d70e2382e65a122c10d47e1ba53da49..75861c492f3f6a8adb7cbab7fe5a1e9396e94383 100644 (file)
@@ -9,7 +9,7 @@
 **  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
@@ -221,47 +221,53 @@ ReconstructorWorker::Entry ()
     *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