Author: tabish
Date: Sun Mar 21 21:54:45 2010
New Revision: 925906
URL: http://svn.apache.org/viewvc?rev=925906&view=rev
Log:
Fix for warnings generated by gcc with -Weffc++ enabled.
Added:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.cpp
(with props)
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Exception.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.h
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am?rev=925906&r1=925905&r2=925906&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am Sun Mar 21
21:54:45 2010
@@ -568,6 +568,7 @@ cc_sources = \
decaf/util/TimerTask.cpp \
decaf/util/UUID.cpp \
decaf/util/concurrent/CountDownLatch.cpp \
+ decaf/util/concurrent/Lock.cpp \
decaf/util/concurrent/Mutex.cpp \
decaf/util/concurrent/PooledThread.cpp \
decaf/util/concurrent/Semaphore.cpp \
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Exception.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Exception.h?rev=925906&r1=925905&r2=925906&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Exception.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Exception.h
Sun Mar 21 21:54:45 2010
@@ -191,7 +191,7 @@ namespace lang{
* Assignment operator.
* @param ex const reference to another Exception
*/
- virtual Exception& operator =( const Exception& ex );
+ Exception& operator =( const Exception& ex );
protected:
Added:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.cpp?rev=925906&view=auto
==============================================================================
---
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.cpp
(added)
+++
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.cpp
Sun Mar 21 21:54:45 2010
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Lock.h"
+
+#include <decaf/lang/Exception.h>
+
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+Lock::Lock( Synchronizable* object, const bool intiallyLocked ) : syncObject(
object ), locked( false ) {
+
+ try{
+ if( intiallyLocked ) {
+ lock();
+ }
+ }
+ DECAF_CATCH_RETHROW( lang::Exception )
+ DECAF_CATCHALL_THROW( lang::Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Lock::~Lock() {
+
+ try{
+ if( locked ) {
+ syncObject->unlock();
+ }
+ }
+ DECAF_CATCH_NOTHROW( Exception )
+ DECAF_CATCHALL_NOTHROW()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Lock::lock() {
+ try{
+ syncObject->lock();
+ locked = true;
+ }
+ DECAF_CATCH_RETHROW( Exception )
+ DECAF_CATCHALL_THROW( Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Lock::unlock() {
+
+ try{
+ if( locked ) {
+ syncObject->unlock();
+ locked = false;
+ }
+ }
+ DECAF_CATCH_RETHROW( Exception )
+ DECAF_CATCHALL_THROW( Exception )
+}
Propchange:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.h?rev=925906&r1=925905&r2=925906&view=diff
==============================================================================
---
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.h
(original)
+++
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.h
Sun Mar 21 21:54:45 2010
@@ -18,7 +18,6 @@
#ifndef _DECAF_UTIL_CONCURRENT_LOCK_H_
#define _DECAF_UTIL_CONCURRENT_LOCK_H_
-#include <decaf/lang/Exception.h>
#include <decaf/util/concurrent/Synchronizable.h>
#include <decaf/util/Config.h>
@@ -32,14 +31,14 @@ namespace concurrent{
*
* @since 1.0
*/
- class Lock {
+ class DECAF_API Lock {
private:
/**
* Flag to indicate whether or not this object has locked the
* sync object.
*/
- bool locked;
+ volatile bool locked;
/**
* The synchronizable object to lock/unlock.
@@ -56,71 +55,36 @@ namespace concurrent{
/**
* Constructor - initializes the object member and locks
* the object if desired.
- * @param object The sync object to control
- * @param intiallyLocked If true, the object will automatically
- * be locked.
- */
- Lock( Synchronizable* object, const bool intiallyLocked = true ) {
-
- try{
- syncObject = object;
- locked = false;
-
- if( intiallyLocked ) {
- lock();
- }
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
- }
+ *
+ * @param object
+ * The sync object to control
+ * @param intiallyLocked
+ * If true, the object will automatically be locked.
+ */
+ Lock( Synchronizable* object, const bool intiallyLocked = true );
/**
* Destructor - Unlocks the object if it is locked.
*/
- virtual ~Lock() {
- try{
-
- if( locked ) {
- syncObject->unlock();
- }
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
- }
+ virtual ~Lock();
/**
* Locks the object.
*/
- void lock() {
- try{
- syncObject->lock();
- locked = true;
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
- }
+ void lock();
/**
* Unlocks the object if it is already locked, otherwise a call to
this method has
* no effect.
*/
- void unlock() {
-
- try{
- if( locked ) {
- syncObject->unlock();
- locked = false;
- }
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
- }
+ void unlock();
/**
* Indicates whether or not the object is locked.
* @return true if the object is locked, otherwise false.
*/
bool isLocked() const{ return locked; }
+
};
}}}