#ifndef liblldb_ThreadList_h_
#define liblldb_ThreadList_h_
#include <vector>
#include "lldb/lldb-private.h"
#include "lldb/Core/UserID.h"
#include "lldb/Utility/Iterable.h"
namespace lldb_private {
class ThreadList
{
friend class Process;
public:
ThreadList (Process *process);
ThreadList (const ThreadList &rhs);
~ThreadList ();
const ThreadList&
operator = (const ThreadList& rhs);
uint32_t
GetSize(bool can_update = true);
void
AddThread (const lldb::ThreadSP &thread_sp);
lldb::ThreadSP
GetSelectedThread ();
bool
SetSelectedThreadByID (lldb::tid_t tid, bool notify = false);
bool
SetSelectedThreadByIndexID (uint32_t index_id, bool notify = false);
void
Clear();
void
Flush();
void
Destroy();
lldb::ThreadSP
GetThreadAtIndex (uint32_t idx, bool can_update = true);
typedef std::vector<lldb::ThreadSP> collection;
typedef LockingAdaptedIterable<collection, lldb::ThreadSP, vector_adapter> ThreadIterable;
ThreadIterable
Threads ()
{
return ThreadIterable(m_threads, GetMutex());
}
lldb::ThreadSP
FindThreadByID (lldb::tid_t tid, bool can_update = true);
lldb::ThreadSP
FindThreadByProtocolID (lldb::tid_t tid, bool can_update = true);
lldb::ThreadSP
RemoveThreadByID (lldb::tid_t tid, bool can_update = true);
lldb::ThreadSP
RemoveThreadByProtocolID (lldb::tid_t tid, bool can_update = true);
lldb::ThreadSP
FindThreadByIndexID (uint32_t index_id, bool can_update = true);
lldb::ThreadSP
GetThreadSPForThreadPtr (Thread *thread_ptr);
bool
ShouldStop (Event *event_ptr);
Vote
ShouldReportStop (Event *event_ptr);
Vote
ShouldReportRun (Event *event_ptr);
void
RefreshStateAfterStop ();
bool
WillResume ();
void
DidResume ();
void
DidStop ();
void
DiscardThreadPlans();
uint32_t
GetStopID () const;
void
SetStopID (uint32_t stop_id);
Mutex &
GetMutex ();
void
Update (ThreadList &rhs);
protected:
void
SetShouldReportStop (Vote vote);
void
NotifySelectedThreadChanged (lldb::tid_t tid);
Process *m_process; uint32_t m_stop_id; collection m_threads; lldb::tid_t m_selected_tid;
private:
ThreadList ();
};
}
#endif // liblldb_ThreadList_h_