subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1495940 - in /subversion/trunk/subversion/bindings/javahl/native: OperationContext.cpp OperationContext.h
Date Mon, 24 Jun 2013 07:34:51 GMT
Author: brane
Date: Mon Jun 24 07:34:50 2013
New Revision: 1495940

URL: http://svn.apache.org/r1495940
Log:
In JavaHL, make cancelling operations thread-safe.

[in subversion/bindings/javahl/native]
* OperationContext.h: Include private/svn_atomic.h.
  (m_cancelOperation): Change type from bool to svn_atomic_t.
* OperationContext.cpp (OperationContext::OperationContext): Initialize
   m_cancelOperation to 0 instead of false.
  (OperationContext::cancelOperation,
   OperationContext::resetCancelRequest,
   OperationContext::isCancelledOperation): Use atomic operations.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/OperationContext.cpp
    subversion/trunk/subversion/bindings/javahl/native/OperationContext.h

Modified: subversion/trunk/subversion/bindings/javahl/native/OperationContext.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/OperationContext.cpp?rev=1495940&r1=1495939&r2=1495940&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/OperationContext.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/OperationContext.cpp Mon Jun 24 07:34:50
2013
@@ -40,7 +40,7 @@
 OperationContext::OperationContext(SVN::Pool &pool)
   : m_config(NULL),
     m_prompter(NULL),
-    m_cancelOperation(false),
+    m_cancelOperation(0),
     m_pool(&pool),
     m_jctx(NULL)
 {}
@@ -279,19 +279,19 @@ const Prompter& OperationContext::getPro
 void
 OperationContext::cancelOperation()
 {
-  m_cancelOperation = true;
+  svn_atomic_set(&m_cancelOperation, 1);
 }
 
 void
 OperationContext::resetCancelRequest()
 {
-  m_cancelOperation = false;
+  svn_atomic_set(&m_cancelOperation, 0);
 }
 
 bool
 OperationContext::isCancelledOperation()
 {
-  return m_cancelOperation;
+  return bool(svn_atomic_read(&m_cancelOperation));
 }
 
 svn_error_t *

Modified: subversion/trunk/subversion/bindings/javahl/native/OperationContext.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/OperationContext.h?rev=1495940&r1=1495939&r2=1495940&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/OperationContext.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/OperationContext.h Mon Jun 24 07:34:50
2013
@@ -31,6 +31,7 @@
 
 #include "svn_types.h"
 #include "svn_client.h"
+#include "private/svn_atomic.h"
 
 #include <jni.h>
 #include "Pool.h"
@@ -51,7 +52,7 @@ class OperationContext
   apr_hash_t * m_config;
 
   Prompter *m_prompter;
-  bool m_cancelOperation;
+  svn_atomic_t m_cancelOperation;
 
  protected:
   SVN::Pool *m_pool;



Mime
View raw message