Files
clang-p2996/lldb/include/lldb/Target/QueueList.h
Kate Stone b9c1b51e45 *** 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
2016-09-06 20:57:50 +00:00

131 lines
4.5 KiB
C++

//===-- QueueList.h --------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_QueueList_h_
#define liblldb_QueueList_h_
#include <mutex>
#include <vector>
#include "lldb/Core/UserID.h"
#include "lldb/Utility/Iterable.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
//------------------------------------------------------------------
// QueueList:
// This is the container for libdispatch aka Grand Central Dispatch
// Queue objects.
//
// Each Process will have a QueueList. When the process execution is
// paused, the QueueList may be populated with Queues by the
// SystemRuntime.
//------------------------------------------------------------------
class QueueList {
friend class Process;
public:
QueueList(Process *process);
~QueueList();
//------------------------------------------------------------------
/// Get the number of libdispatch queues that are available
///
/// @return
/// The number of queues that are stored in the QueueList.
//------------------------------------------------------------------
uint32_t GetSize();
//------------------------------------------------------------------
/// Get the Queue at a given index number
///
/// @param [in] idx
/// The index number (0-based) of the queue.
/// @return
/// The Queue at that index number.
//------------------------------------------------------------------
lldb::QueueSP GetQueueAtIndex(uint32_t idx);
typedef std::vector<lldb::QueueSP> collection;
typedef LockingAdaptedIterable<collection, lldb::QueueSP, vector_adapter,
std::mutex>
QueueIterable;
//------------------------------------------------------------------
/// Iterate over the list of queues
///
/// @return
/// An Iterable object which can be used to loop over the queues
/// that exist.
//------------------------------------------------------------------
QueueIterable Queues() { return QueueIterable(m_queues, m_mutex); }
//------------------------------------------------------------------
/// Clear out the list of queues from the QueueList
//------------------------------------------------------------------
void Clear();
//------------------------------------------------------------------
/// Add a Queue to the QueueList
///
/// @param [in] queue
/// Used by the SystemRuntime to populate the QueueList
//------------------------------------------------------------------
void AddQueue(lldb::QueueSP queue);
//------------------------------------------------------------------
/// Find a queue in the QueueList by QueueID
///
/// @param [in] qid
/// The QueueID (same as returned by Thread::GetQueueID()) to find.
///
/// @return
/// A QueueSP to the queue requested, if it is present in the QueueList.
/// An empty QueueSP will be returned if this queue was not found.
//------------------------------------------------------------------
lldb::QueueSP FindQueueByID(lldb::queue_id_t qid);
//------------------------------------------------------------------
/// Find a queue in the QueueList by IndexID
///
/// @param [in] index_id
/// Find a queue by IndexID. This is an integer associated with each
/// unique queue seen during a debug session and will not be reused
/// for a different queue. Unlike the QueueID, a 64-bit value, this
/// will tend to be an integral value like 1 or 7.
///
/// @return
/// A QueueSP to the queue requested, if it is present in the QueueList.
/// An empty QueueSP will be returned if this queue was not found.
//------------------------------------------------------------------
lldb::QueueSP FindQueueByIndexID(uint32_t index_id);
std::mutex &GetMutex();
protected:
//------------------------------------------------------------------
// Classes that inherit from Process can see and modify these
//------------------------------------------------------------------
Process *m_process; ///< The process that manages this queue list.
uint32_t
m_stop_id; ///< The process stop ID that this queue list is valid for.
collection m_queues; ///< The queues for this process.
std::mutex m_mutex;
private:
QueueList();
};
} // namespace lldb_private
#endif // liblldb_QueueList_h_