diff options
Diffstat (limited to 'include/lldb/Host/Mutex.h')
-rw-r--r-- | include/lldb/Host/Mutex.h | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/include/lldb/Host/Mutex.h b/include/lldb/Host/Mutex.h index 496dd0496c130..5a529fb4554dd 100644 --- a/include/lldb/Host/Mutex.h +++ b/include/lldb/Host/Mutex.h @@ -9,15 +9,17 @@ #ifndef liblldb_Mutex_h_ #define liblldb_Mutex_h_ -#if defined(__cplusplus) - -#include "lldb/lldb-types.h" -#include <assert.h> +// C Includes +// C++ Includes #ifdef LLDB_CONFIGURATION_DEBUG #include <string> #endif +// Other libraries and framework includes +// Project includes +#include "lldb/lldb-types.h" + namespace lldb_private { //---------------------------------------------------------------------- @@ -85,7 +87,7 @@ public: Locker(Mutex* m); //-------------------------------------------------------------- - /// Desstructor + /// Destructor /// /// Unlocks any valid pthread_mutex_t that this object may /// contain. @@ -97,7 +99,7 @@ public: /// /// Unlock the current mutex in this object (if it contains a /// valid mutex) and lock the new \a mutex object if it is - /// non-NULL. + /// non-nullptr. //-------------------------------------------------------------- void Lock (Mutex &mutex); @@ -120,15 +122,15 @@ public: /// will not take ownership of the mutex. /// /// @return - /// Returns \b true if the lock was aquired and the this + /// Returns \b true if the lock was acquired and the this /// object will unlock the mutex when it goes out of scope, /// returns \b false otherwise. //-------------------------------------------------------------- bool - TryLock (Mutex &mutex, const char *failure_message = NULL); + TryLock(Mutex &mutex, const char *failure_message = nullptr); bool - TryLock (Mutex *mutex, const char *failure_message = NULL) + TryLock(Mutex *mutex, const char *failure_message = nullptr) { if (mutex) return TryLock(*mutex, failure_message); @@ -150,7 +152,6 @@ public: const Locker& operator=(const Locker&); }; - //------------------------------------------------------------------ /// Default constructor. /// @@ -213,7 +214,7 @@ public: virtual #endif int - TryLock(const char *failure_message = NULL); + TryLock(const char *failure_message = nullptr); //------------------------------------------------------------------ /// Unlock the mutex. @@ -262,16 +263,16 @@ public: TrackingMutex(Mutex::Type type) : Mutex (type) {} virtual - ~TrackingMutex() {} + ~TrackingMutex() = default; virtual int Unlock (); virtual int - TryLock (const char *failure_message = NULL) + TryLock(const char *failure_message = nullptr) { int return_value = Mutex::TryLock(); - if (return_value != 0 && failure_message != NULL) + if (return_value != 0 && failure_message != nullptr) { m_failure_message.assign(failure_message); m_thread_that_tried = pthread_self(); @@ -291,7 +292,7 @@ public: LoggingMutex(Mutex::Type type) : Mutex (type),m_locked(false) {} virtual - ~LoggingMutex() {} + ~LoggingMutex() = default; virtual int Lock (); @@ -300,13 +301,13 @@ public: Unlock (); virtual int - TryLock (const char *failure_message = NULL); + TryLock(const char *failure_message = nullptr); + protected: bool m_locked; }; -#endif +#endif // LLDB_CONFIGURATION_DEBUG } // namespace lldb_private -#endif // #if defined(__cplusplus) -#endif +#endif // liblldb_Mutex_h_ |