aboutsummaryrefslogtreecommitdiff
path: root/lldb/tools/lldb-mi/MICmnThreadMgrStd.h
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/tools/lldb-mi/MICmnThreadMgrStd.h
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadllvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.bz2
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/tools/lldb-mi/MICmnThreadMgrStd.h')
-rw-r--r--lldb/tools/lldb-mi/MICmnThreadMgrStd.h178
1 files changed, 90 insertions, 88 deletions
diff --git a/lldb/tools/lldb-mi/MICmnThreadMgrStd.h b/lldb/tools/lldb-mi/MICmnThreadMgrStd.h
index fc0013f..86f5bc7 100644
--- a/lldb/tools/lldb-mi/MICmnThreadMgrStd.h
+++ b/lldb/tools/lldb-mi/MICmnThreadMgrStd.h
@@ -14,11 +14,12 @@
// In-house headers:
#include "MICmnBase.h"
-#include "MIUtilThreadBaseStd.h"
#include "MICmnResources.h"
#include "MIUtilSingletonBase.h"
+#include "MIUtilThreadBaseStd.h"
-//++ ============================================================================
+//++
+//============================================================================
// Details: MI's worker thread (active thread) manager.
// The manager creates threads and behalf of clients. Client are
// responsible for their threads and can delete them when necessary.
@@ -26,98 +27,99 @@
// shutdown.
// Singleton class.
//--
-class CMICmnThreadMgrStd : public CMICmnBase, public MI::ISingleton<CMICmnThreadMgrStd>
-{
- friend MI::ISingleton<CMICmnThreadMgrStd>;
-
- // Methods:
- public:
- bool Initialize() override;
- bool Shutdown() override;
- bool
- ThreadAllTerminate(); // Ask all threads to stop (caution)
- template <typename T> // Ask the thread manager to start and stop threads on our behalf
- bool ThreadStart(T &vrwObject);
-
- // Typedef:
- private:
- typedef std::vector<CMIUtilThreadActiveObjBase *> ThreadList_t;
-
- // Methods:
- private:
- /* ctor */ CMICmnThreadMgrStd();
- /* ctor */ CMICmnThreadMgrStd(const CMICmnThreadMgrStd &);
- void operator=(const CMICmnThreadMgrStd &);
- //
- bool
- AddThread(const CMIUtilThreadActiveObjBase &vrObj); // Add a thread for monitoring by the threadmanager
-
- // Overridden:
- private:
- // From CMICmnBase
- /* dtor */ ~CMICmnThreadMgrStd() override;
-
- // Attributes:
- private:
- CMIUtilThreadMutex m_mutex;
- ThreadList_t m_threadList;
+class CMICmnThreadMgrStd : public CMICmnBase,
+ public MI::ISingleton<CMICmnThreadMgrStd> {
+ friend MI::ISingleton<CMICmnThreadMgrStd>;
+
+ // Methods:
+public:
+ bool Initialize() override;
+ bool Shutdown() override;
+ bool ThreadAllTerminate(); // Ask all threads to stop (caution)
+ template <typename T> // Ask the thread manager to start and stop threads on
+ // our behalf
+ bool ThreadStart(T &vrwObject);
+
+ // Typedef:
+private:
+ typedef std::vector<CMIUtilThreadActiveObjBase *> ThreadList_t;
+
+ // Methods:
+private:
+ /* ctor */ CMICmnThreadMgrStd();
+ /* ctor */ CMICmnThreadMgrStd(const CMICmnThreadMgrStd &);
+ void operator=(const CMICmnThreadMgrStd &);
+ //
+ bool AddThread(const CMIUtilThreadActiveObjBase &
+ vrObj); // Add a thread for monitoring by the threadmanager
+
+ // Overridden:
+private:
+ // From CMICmnBase
+ /* dtor */ ~CMICmnThreadMgrStd() override;
+
+ // Attributes:
+private:
+ CMIUtilThreadMutex m_mutex;
+ ThreadList_t m_threadList;
};
-//++ ------------------------------------------------------------------------------------
-// Details: Given a thread object start its (worker) thread to do work. The object is
-// added to the *this manager for housekeeping and deletion of all thread objects.
+//++
+//------------------------------------------------------------------------------------
+// Details: Given a thread object start its (worker) thread to do work. The
+// object is
+// added to the *this manager for housekeeping and deletion of all
+// thread objects.
// Type: Template method.
-// Args: vrwThreadObj - (RW) A CMIUtilThreadActiveObjBase derived object.
+// Args: vrwThreadObj - (RW) A CMIUtilThreadActiveObjBase derived
+// object.
// Return: MIstatus::success - Functional succeeded.
// MIstatus::failure - Functional failed.
// Throws: None.
//--
-template <typename T>
-bool
-CMICmnThreadMgrStd::ThreadStart(T &vrwThreadObj)
-{
- bool bOk = MIstatus::success;
-
- // Grab a reference to the base object type
- CMIUtilThreadActiveObjBase &rObj = static_cast<CMIUtilThreadActiveObjBase &>(vrwThreadObj);
-
- // Add to the thread managers internal database
- bOk &= AddThread(rObj);
- if (!bOk)
- {
- const CMIUtilString errMsg(
- CMIUtilString::Format(MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE), vrwThreadObj.ThreadGetName().c_str()));
- SetErrorDescription(errMsg);
- return MIstatus::failure;
- }
-
- // Grab a reference on behalf of the caller
- bOk &= vrwThreadObj.Acquire();
- if (!bOk)
- {
- const CMIUtilString errMsg(
- CMIUtilString::Format(MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE), vrwThreadObj.ThreadGetName().c_str()));
- SetErrorDescription(errMsg);
- return MIstatus::failure;
- }
-
- // Thread is already started
- // This call must come after the reference count increment
- if (vrwThreadObj.ThreadIsActive())
- {
- // Early exit on thread already running condition
- return MIstatus::success;
- }
-
- // Start the thread running
- bOk &= vrwThreadObj.ThreadExecute();
- if (!bOk)
- {
- const CMIUtilString errMsg(
- CMIUtilString::Format(MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE), vrwThreadObj.ThreadGetName().c_str()));
- SetErrorDescription(errMsg);
- return MIstatus::failure;
- }
-
+template <typename T> bool CMICmnThreadMgrStd::ThreadStart(T &vrwThreadObj) {
+ bool bOk = MIstatus::success;
+
+ // Grab a reference to the base object type
+ CMIUtilThreadActiveObjBase &rObj =
+ static_cast<CMIUtilThreadActiveObjBase &>(vrwThreadObj);
+
+ // Add to the thread managers internal database
+ bOk &= AddThread(rObj);
+ if (!bOk) {
+ const CMIUtilString errMsg(
+ CMIUtilString::Format(MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE),
+ vrwThreadObj.ThreadGetName().c_str()));
+ SetErrorDescription(errMsg);
+ return MIstatus::failure;
+ }
+
+ // Grab a reference on behalf of the caller
+ bOk &= vrwThreadObj.Acquire();
+ if (!bOk) {
+ const CMIUtilString errMsg(
+ CMIUtilString::Format(MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE),
+ vrwThreadObj.ThreadGetName().c_str()));
+ SetErrorDescription(errMsg);
+ return MIstatus::failure;
+ }
+
+ // Thread is already started
+ // This call must come after the reference count increment
+ if (vrwThreadObj.ThreadIsActive()) {
+ // Early exit on thread already running condition
return MIstatus::success;
+ }
+
+ // Start the thread running
+ bOk &= vrwThreadObj.ThreadExecute();
+ if (!bOk) {
+ const CMIUtilString errMsg(
+ CMIUtilString::Format(MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE),
+ vrwThreadObj.ThreadGetName().c_str()));
+ SetErrorDescription(errMsg);
+ return MIstatus::failure;
+ }
+
+ return MIstatus::success;
}