qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1057350 - in /qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src: Address.cpp Address.h Connection.cpp Connection.h FailoverUpdates.cpp FailoverUpdates.h Message.cpp Message.h Receiver.cpp Receiver.h Sender.cpp Sender.h Session.cpp Session.h
Date Mon, 10 Jan 2011 20:43:57 GMT
Author: chug
Date: Mon Jan 10 20:43:56 2011
New Revision: 1057350

URL: http://svn.apache.org/viewvc?rev=1057350&view=rev
Log:
.NET Binding for Qpid Messaging, in every .NET object that keeps 
a reference to unmanaged memory:
* Function Cleanup() is deleted and cleanup is moved to Finalizer.
* Destructor calls Finalizer.
* Finalizer takes a lock before deleting unmanaged memory.

Modified:
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.h
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.h
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.cpp
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.h
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.h

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp?rev=1057350&r1=1057349&r2=1057350&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp Mon Jan 10 20:43:56 2011
@@ -187,21 +187,15 @@ namespace Messaging {
     // Destructor
     Address::~Address()
     {
-        Cleanup();
+        this->!Address();
     }
 
 
     // Finalizer
     Address::!Address()
     {
-        Cleanup();
-    }
-
+        msclr::lock lk(this);
 
-    // Destroys kept object
-    // TODO: add lock
-    void Address::Cleanup()
-    {
         if (NULL != addressp)
         {
             delete addressp;

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.h?rev=1057350&r1=1057349&r2=1057350&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.h (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Address.h Mon Jan 10 20:43:56 2011
@@ -43,9 +43,6 @@ namespace Messaging {
     public ref class Address
     {
     private:
-        // Kept object deletion code
-        void Cleanup();
-
         // The kept object in the Messaging C++ DLL
         ::qpid::messaging::Address * addressp;
 

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp?rev=1057350&r1=1057349&r2=1057350&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp Mon Jan 10 20:43:56 2011
@@ -140,21 +140,15 @@ namespace Messaging {
     // Destructor
     Connection::~Connection()
     {
-        Cleanup();
+        this->!Connection();
     }
 
 
     // Finalizer
     Connection::!Connection()
     {
-        Cleanup();
-    }
-
+        msclr::lock lk(this);
 
-    // Destroys kept object
-    // TODO: add lock
-    void Connection::Cleanup()
-    {
         if (NULL != connectionp)
         {
             delete connectionp;

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.h?rev=1057350&r1=1057349&r2=1057350&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.h (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Connection.h Mon Jan 10 20:43:56 2011
@@ -45,9 +45,6 @@ namespace Messaging {
         // The kept object in the Messaging C++ DLL
         ::qpid::messaging::Connection * connectionp;
 
-        // Kept object deletion code
-        void Cleanup();
-
     public:
         Connection(System::String ^ url);
 

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.cpp?rev=1057350&r1=1057349&r2=1057350&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.cpp (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.cpp Mon Jan 10 20:43:56 2011
@@ -64,21 +64,15 @@ namespace Messaging {
     // Destructor
     FailoverUpdates::~FailoverUpdates()
     {
-        Cleanup();
+        this->!FailoverUpdates();
     }
 
 
     // Finalizer
     FailoverUpdates::!FailoverUpdates()
     {
-        Cleanup();
-    }
-
+        msclr::lock lk(this);
 
-    // Destroys kept object
-    // TODO: add lock
-    void FailoverUpdates::Cleanup()
-    {
         if (NULL != failoverupdatesp)
         {
             delete failoverupdatesp;

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h?rev=1057350&r1=1057349&r2=1057350&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h Mon Jan 10 20:43:56 2011
@@ -42,9 +42,6 @@ namespace Messaging {
         // The kept object in the Messaging C++ DLL
         ::qpid::messaging::FailoverUpdates * failoverupdatesp;
 
-        // Kept object deletion code
-        void Cleanup();
-
     public:
         FailoverUpdates(Connection ^ connection);
 

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp?rev=1057350&r1=1057349&r2=1057350&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp Mon Jan 10 20:43:56 2011
@@ -219,14 +219,20 @@ namespace Messaging {
     // Destructor
     Message::~Message()
     {
-        Cleanup();
+        this->!Message();
     }
 
 
     // Finalizer
     Message::!Message()
     {
-        Cleanup();
+        msclr::lock lk(this);
+
+        if (NULL != messagep)
+        {
+            delete messagep;
+            messagep = NULL;
+        }
     }
 
     // Copy constructor
@@ -251,17 +257,6 @@ namespace Messaging {
 		}
     }
 
-    // Destroys kept object
-    // TODO: add lock
-    void Message::Cleanup()
-    {
-        if (NULL != messagep)
-        {
-            delete messagep;
-            messagep = NULL;
-        }
-    }
-
 	// Property
     void Message::SetProperty(System::String ^ name, System::Object ^ value)
     {

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h?rev=1057350&r1=1057349&r2=1057350&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h Mon Jan 10 20:43:56 2011
@@ -47,9 +47,6 @@ namespace Messaging {
     {
 
     private:
-        // Kept object deletion code
-        void Cleanup();
-
         // The kept object in the Messaging C++ DLL
         ::qpid::messaging::Message * messagep;
 

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp?rev=1057350&r1=1057349&r2=1057350&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp Mon Jan 10 20:43:56 2011
@@ -72,14 +72,20 @@ namespace Messaging {
     // Destructor
     Receiver::~Receiver()
     {
-        Cleanup();
+        this->!Receiver();
     }
 
 
     // Finalizer
     Receiver::!Receiver()
     {
-        Cleanup();
+        msclr::lock lk(this);
+
+        if (NULL != receiverp)
+        {
+            delete receiverp;
+            receiverp = NULL;
+        }
     }
 
 
@@ -107,17 +113,6 @@ namespace Messaging {
     }
 
 
-    // Destroys kept object
-    // TODO: add lock
-    void Receiver::Cleanup()
-    {
-        if (NULL != receiverp)
-        {
-            delete receiverp;
-            receiverp = NULL;
-        }
-    }
-
     //
     // Get(message)
     //

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h?rev=1057350&r1=1057349&r2=1057350&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h Mon Jan 10 20:43:56 2011
@@ -54,9 +54,6 @@ namespace Messaging {
         // The session that created this Receiver
         Session ^ parentSession;
 
-        // Kept object deletion code
-        void Cleanup();
-
         // The kept object in the Messaging C++ DLL
         ::qpid::messaging::Receiver * receiverp;
 

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp?rev=1057350&r1=1057349&r2=1057350&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp Mon Jan 10 20:43:56 2011
@@ -67,16 +67,23 @@ namespace Messaging {
     // Destructor
     Sender::~Sender()
     {
-        Cleanup();
+        this->!Sender();
     }
 
 
     // Finalizer
     Sender::!Sender()
     {
-        Cleanup();
+        msclr::lock lk(this);
+
+        if (NULL != senderp)
+        {
+            delete senderp;
+            senderp = NULL;
+        }
     }
 
+
     // Copy constructor
     Sender::Sender(const Sender ^ sender)
         : parentSession(sender->parentSession)
@@ -101,17 +108,6 @@ namespace Messaging {
     }
 
 
-    // Destroys kept object
-    // TODO: add lock
-    void Sender::Cleanup()
-    {
-        if (NULL != senderp)
-        {
-            delete senderp;
-            senderp = NULL;
-        }
-    }
-
     //
     // Send(msg)
     //

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.h?rev=1057350&r1=1057349&r2=1057350&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.h (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Sender.h Mon Jan 10 20:43:56 2011
@@ -55,9 +55,6 @@ namespace Messaging {
         // The session that created this Sender
         Session ^ parentSession;
 
-        // Kept object deletion code
-        void Cleanup();
-
     public:
         // unmanaged clone
         Sender(const ::qpid::messaging::Sender & s,

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp?rev=1057350&r1=1057349&r2=1057350&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp Mon Jan 10 20:43:56 2011
@@ -72,16 +72,23 @@ namespace Messaging {
     // Destructor
     Session::~Session()
     {
-        Cleanup();
+        this->!Session();
     }
 
 
     // Finalizer
     Session::!Session()
     {
-        Cleanup();
+        msclr::lock lk(this);
+
+        if (NULL != sessionp)
+        {
+            delete sessionp;
+            sessionp = NULL;
+        }
     }
 
+
     // Copy constructor
     Session::Session(const Session ^ session)
         : parentConnectionp(session->parentConnectionp)
@@ -107,17 +114,6 @@ namespace Messaging {
     }
 
 
-    // Destroys kept object
-    // TODO: add lock
-    void Session::Cleanup()
-    {
-        if (NULL != sessionp)
-        {
-            delete sessionp;
-            sessionp = NULL;
-        }
-    }
-
     void Session::Close()
     {
         System::Exception ^ newException = nullptr;

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.h?rev=1057350&r1=1057349&r2=1057350&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.h (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Session.h Mon Jan 10 20:43:56 2011
@@ -61,9 +61,6 @@ namespace Messaging {
         // The connection that created this session
         Connection ^ parentConnectionp;
 
-        // Kept object deletion code
-        void Cleanup();
-
     public:
 
         // unmanaged clone



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message