diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-09-07 15:34:06 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-09-07 15:34:06 -0400 |
commit | 1e2e7ed93ce4fbe4f1f1ef5c100b38a2edb31527 (patch) | |
tree | bb69ccda51b972d01ad1c3381b8d307cdeca5232 /cpp/src/Freeze/ConnectionI.h | |
parent | updating reserved words & keyword test (diff) | |
download | ice-1e2e7ed93ce4fbe4f1f1ef5c100b38a2edb31527.tar.bz2 ice-1e2e7ed93ce4fbe4f1f1ef5c100b38a2edb31527.tar.xz ice-1e2e7ed93ce4fbe4f1f1ef5c100b38a2edb31527.zip |
Refcounting is now thread-safe
Diffstat (limited to 'cpp/src/Freeze/ConnectionI.h')
-rw-r--r-- | cpp/src/Freeze/ConnectionI.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/cpp/src/Freeze/ConnectionI.h b/cpp/src/Freeze/ConnectionI.h index 31d8e206eb5..38b85aa9d2b 100644 --- a/cpp/src/Freeze/ConnectionI.h +++ b/cpp/src/Freeze/ConnectionI.h @@ -21,6 +21,17 @@ namespace Freeze class MapHelperI; +// +// A mutex shared by a connection and all its transactions +// (for refcounting thread-safety) +// +struct SharedMutex : public IceUtil::Shared +{ + IceUtil::Mutex mutex; +}; +typedef IceUtil::Handle<SharedMutex> SharedMutexPtr; + + class ConnectionI : public Connection { public: @@ -38,8 +49,10 @@ public: // // Custom refcounting implementation // + virtual void __incRef(); virtual void __decRef(); - + virtual int __getRef() const; + virtual ~ConnectionI(); ConnectionI(const SharedDbEnvPtr&); @@ -70,6 +83,10 @@ public: private: + friend class TransactionI; + + int __getRefNoSync() const; + const Ice::CommunicatorPtr _communicator; SharedDbEnvPtr _dbEnv; const std::string _envName; @@ -78,6 +95,8 @@ private: const Ice::Int _trace; const Ice::Int _txTrace; const bool _deadlockWarning; + SharedMutexPtr _refCountMutex; + int _refCount; }; typedef IceUtil::Handle<ConnectionI> ConnectionIPtr; |