From 74a94dd492f9bcabf442e3f0c89dbb7cf8463cf8 Mon Sep 17 00:00:00 2001
From: Tavian Barnes <tavianator@gmail.com>
Date: Wed, 1 Jul 2009 05:05:12 +0000
Subject: Check for failure of worker thread in C++ dmnsn_progress* wrapper.

---
 libdimensionxx/progress.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

(limited to 'libdimensionxx')

diff --git a/libdimensionxx/progress.cpp b/libdimensionxx/progress.cpp
index 0a32b72..66d9d7f 100644
--- a/libdimensionxx/progress.cpp
+++ b/libdimensionxx/progress.cpp
@@ -38,12 +38,11 @@ namespace Dimension
   // Finish the progress if not yet finished and we are unique
   Progress::~Progress()
   {
-    if (m_progress && m_progress.unique()) {
+    if (m_progress) {
       try {
-        dmnsn_finish_progress(dmnsn());
+        finish();
       } catch (...) {
-        dmnsn_error(SEVERITY_MEDIUM,
-                    "Finishing worker thread failed in Progress destructor.");
+        dmnsn_error(SEVERITY_MEDIUM, "Finishing worker thread failed.");
       }
     }
   }
@@ -95,7 +94,10 @@ namespace Dimension
       throw Dimension_Error("Attempt to finish non-unique Progress.");
     }
 
-    dmnsn_finish_progress(dmnsn());
+    if (dmnsn_finish_progress(dmnsn()) != 0) {
+      throw Dimension_Error("Worker thread failed.");
+    }
+
     m_progress.reset(); // Don't try again
   }
 
-- 
cgit v1.2.3