[Lldb-commits] [PATCH] Remove unused code

Ed Maste emaste at freebsd.org
Mon Jul 15 13:39:58 PDT 2013


RunLocker was not used anywhere, and was the only instance of the
WriteLocker class.  Remove both.
---
This is part of my series to fix run / stop locking on FreeBSD.  This
patch just removes completely unused code, and I'd just like a
confirmation that there's no plan for it to start being used, before
committing.

I'll wait for more testing (on Linux / OS X) of the functional changes
before going ahead with those.

 include/lldb/Host/ReadWriteLock.h | 58 ---------------------------------------
 include/lldb/Target/Process.h     |  1 -
 2 files changed, 59 deletions(-)

diff --git a/include/lldb/Host/ReadWriteLock.h b/include/lldb/Host/ReadWriteLock.h
index dfef3ad..2dc81fb 100644
--- a/include/lldb/Host/ReadWriteLock.h
+++ b/include/lldb/Host/ReadWriteLock.h
@@ -170,64 +170,6 @@ public:
         DISALLOW_COPY_AND_ASSIGN(ReadLocker);
     };
 
-    class WriteLocker
-    {
-    public:
-        WriteLocker () :
-            m_lock (NULL)
-        {
-        }
-
-        WriteLocker (ReadWriteLock &lock) :
-            m_lock (NULL)
-        {
-            Lock(&lock);
-        }
-
-        WriteLocker (ReadWriteLock *lock) :
-            m_lock (NULL)
-        {
-            Lock(lock);
-        }
-
-        ~WriteLocker()
-        {
-            Unlock();
-        }
-
-        void
-        Lock (ReadWriteLock *lock)
-        {
-            if (m_lock)
-            {
-                if (m_lock == lock)
-                    return; // We already have this lock locked
-                else
-                    Unlock();
-            }
-            if (lock)
-            {
-                lock->WriteLock();
-                m_lock = lock;
-            }
-        }
-
-        void
-        Unlock ()
-        {
-            if (m_lock)
-            {
-                m_lock->WriteUnlock();
-                m_lock = NULL;
-            }
-        }
-        
-    protected:
-        ReadWriteLock *m_lock;
-    private:
-        DISALLOW_COPY_AND_ASSIGN(WriteLocker);
-    };
-
 protected:
     pthread_rwlock_t m_rwlock;
 private:
diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h
index fe8e207..7d4a304 100644
--- a/include/lldb/Target/Process.h
+++ b/include/lldb/Target/Process.h
@@ -1393,7 +1393,6 @@ public:
     // try to lock it to see if they can immediately access the stopped
     // process. If the try read lock fails, then the process is running.
     typedef ReadWriteLock::ReadLocker StopLocker;
-    typedef ReadWriteLock::WriteLocker RunLocker;
 
     // These two functions fill out the Broadcaster interface:
     
-- 
1.7.11.5




More information about the lldb-commits mailing list