Author: tabish
Date: Mon Dec 20 19:40:01 2010
New Revision: 1051257

URL: http://svn.apache.org/viewvc?rev=1051257&view=rev
Log:
Perform the create and destroy operations in a more consist way.

Modified:
    
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/ConditionHandle.h
    
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/ConditionImpl.cpp
    
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/MutexHandle.h
    
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/MutexImpl.cpp
    
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/ConditionHandle.h
    
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/ConditionImpl.cpp
    
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/MutexHandle.h
    
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/MutexImpl.cpp

Modified: 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/ConditionHandle.h
URL: 
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/ConditionHandle.h?rev=1051257&r1=1051256&r2=1051257&view=diff
==============================================================================
--- 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/ConditionHandle.h
 (original)
+++ 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/ConditionHandle.h
 Mon Dec 20 19:40:01 2010
@@ -43,7 +43,6 @@ namespace concurrent {
         }
 
         ~ConditionHandle() {
-            pthread_cond_destroy( &condition );
         }
 
         // The actual condition object

Modified: 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/ConditionImpl.cpp
URL: 
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/ConditionImpl.cpp?rev=1051257&r1=1051256&r2=1051257&view=diff
==============================================================================
--- 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/ConditionImpl.cpp
 (original)
+++ 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/ConditionImpl.cpp
 Mon Dec 20 19:40:01 2010
@@ -76,6 +76,13 @@ ConditionHandle* ConditionImpl::create( 
 
 
////////////////////////////////////////////////////////////////////////////////
 void ConditionImpl::destroy( decaf::util::concurrent::ConditionHandle* handle 
) {
+
+    if( handle == NULL ) {
+        throw RuntimeException(
+            __FILE__, __LINE__, "Handle to Condition was NULL." );
+    }
+
+    pthread_cond_destroy( &handle->condition );
     delete handle;
 }
 

Modified: 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/MutexHandle.h
URL: 
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/MutexHandle.h?rev=1051257&r1=1051256&r2=1051257&view=diff
==============================================================================
--- 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/MutexHandle.h
 (original)
+++ 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/MutexHandle.h
 Mon Dec 20 19:40:01 2010
@@ -36,7 +36,6 @@ namespace concurrent {
         }
 
         ~MutexHandle() {
-            pthread_mutex_destroy( &mutex );
         }
 
         // The mutex object.

Modified: 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/MutexImpl.cpp
URL: 
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/MutexImpl.cpp?rev=1051257&r1=1051256&r2=1051257&view=diff
==============================================================================
--- 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/MutexImpl.cpp
 (original)
+++ 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/unix/MutexImpl.cpp
 Mon Dec 20 19:40:01 2010
@@ -43,7 +43,6 @@ MutexHandle* MutexImpl::create() {
     std::auto_ptr<MutexHandle> handle( new MutexHandle );
 
     if( pthread_mutex_init( &( handle->mutex ), NULL ) != 0 ) {
-
         throw RuntimeException(
             __FILE__, __LINE__, "Failed to create Mutex object." );
     }
@@ -56,6 +55,13 @@ MutexHandle* MutexImpl::create() {
 
 
////////////////////////////////////////////////////////////////////////////////
 void MutexImpl::destroy( decaf::util::concurrent::MutexHandle* handle ) {
+
+    if( handle == NULL ) {
+        throw RuntimeException(
+            __FILE__, __LINE__, "Handle to Mutex was NULL." );
+    }
+
+    pthread_mutex_destroy( &handle->mutex );
     delete handle;
 }
 

Modified: 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/ConditionHandle.h
URL: 
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/ConditionHandle.h?rev=1051257&r1=1051256&r2=1051257&view=diff
==============================================================================
--- 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/ConditionHandle.h
 (original)
+++ 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/ConditionHandle.h
 Mon Dec 20 19:40:01 2010
@@ -39,8 +39,6 @@ namespace concurrent {
         }
 
         ~ConditionHandle() {
-            CloseHandle( semaphore );
-            ::DeleteCriticalSection( &criticalSection );
         }
 
         // The actual condition object

Modified: 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/ConditionImpl.cpp
URL: 
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/ConditionImpl.cpp?rev=1051257&r1=1051256&r2=1051257&view=diff
==============================================================================
--- 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/ConditionImpl.cpp
 (original)
+++ 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/ConditionImpl.cpp
 Mon Dec 20 19:40:01 2010
@@ -62,6 +62,15 @@ ConditionHandle* ConditionImpl::create( 
 
 
////////////////////////////////////////////////////////////////////////////////
 void ConditionImpl::destroy( decaf::util::concurrent::ConditionHandle* handle 
) {
+
+    if( handle == NULL ) {
+        throw RuntimeException(
+            __FILE__, __LINE__, "Handle to Condition Object was Null." );
+    }
+
+    CloseHandle( handle->semaphore );
+    ::DeleteCriticalSection( &handle->criticalSection );
+
     delete handle;
 }
 

Modified: 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/MutexHandle.h
URL: 
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/MutexHandle.h?rev=1051257&r1=1051256&r2=1051257&view=diff
==============================================================================
--- 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/MutexHandle.h
 (original)
+++ 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/MutexHandle.h
 Mon Dec 20 19:40:01 2010
@@ -32,7 +32,6 @@ namespace concurrent {
         }
 
         ~MutexHandle() {
-            DeleteCriticalSection( &mutex );
         }
 
         // The mutex object.

Modified: 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/MutexImpl.cpp
URL: 
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/MutexImpl.cpp?rev=1051257&r1=1051256&r2=1051257&view=diff
==============================================================================
--- 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/MutexImpl.cpp
 (original)
+++ 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/windows/MutexImpl.cpp
 Mon Dec 20 19:40:01 2010
@@ -52,6 +52,14 @@ MutexHandle* MutexImpl::create() {
 
 
////////////////////////////////////////////////////////////////////////////////
 void MutexImpl::destroy( decaf::util::concurrent::MutexHandle* handle ) {
+
+    if( handle == NULL ) {
+        throw RuntimeException(
+            __FILE__, __LINE__, "Handle to Mutex Object was Null." );
+    }
+
+    DeleteCriticalSection( &handle->mutex );
+
     delete handle;
 }
 


Reply via email to