Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <thread.h>
Public Member Functions | |
ThreadGroup () | |
ThreadGroup (CgroupsMgr *cgroups_mgr, const std::string &cgroup) | |
Status | AddThread (Thread *thread) |
void | JoinAll () |
Status | SetCgroup (const std::string &cgroup) |
void | SetCgroupsMgr (CgroupsMgr *cgroups_mgr) |
Private Attributes | |
boost::ptr_vector< Thread > | threads_ |
All the threads grouped by this set. More... | |
CgroupsMgr * | cgroups_mgr_ |
Cgroups manager for assigning threads in this group to cgroups. Not owned. More... | |
std::string | cgroup_path_ |
Utility class to group together a set of threads. A replacement for boost::thread_group.
|
inline |
Adds a new Thread to this group. The ThreadGroup takes ownership of the Thread, and will destroy it when the ThreadGroup is destroyed. Threads will linger until that point (even if terminated), however, so callers should be mindful of the cost of placing very many threads in this set. If cgroup_path_ / cgroup_prefix_ are set, the thread will be added to the specified cgroup and an error will be returned if that operation fails.
Definition at line 318 of file thread.cc.
References impala::OK, and RETURN_IF_ERROR.
Referenced by impala::ParallelExecutor::Exec(), impala::DiskIoMgr::Init(), impala::ThreadPool< TRowBatch * >::ThreadPool(), and impala::HdfsScanNode::ThreadTokenAvailableCb().
void impala::ThreadGroup::JoinAll | ( | ) |
Waits for all threads to finish. DO NOT call this from a thread inside this set; deadlock will predictably ensue.
Definition at line 327 of file thread.cc.
References impala::Thread::Join().
Referenced by impala::HdfsScanNode::Close(), impala::ParallelExecutor::Exec(), impala::ThreadPool< TRowBatch * >::Join(), and impala::DiskIoMgr::~DiskIoMgr().
Status impala::ThreadGroup::SetCgroup | ( | const std::string & | cgroup | ) |
Assigns all current and future threads to the given cgroup managed by cgroups_mgr_. Must be called after SetCgroupsMgr() if groups_mgr_ has not been set already. Returns an error if any assignment was not possible, but does not undo previously successful assignments.
Definition at line 333 of file thread.cc.
References impala::OK, and RETURN_IF_ERROR.
Referenced by impala::ThreadPool< TRowBatch * >::AssignToCgroup(), and impala::HdfsScanNode::Prepare().
|
inline |
Definition at line 186 of file thread.h.
References cgroups_mgr_.
Referenced by impala::HdfsScanNode::Prepare().
|
private |
|
private |
Cgroups manager for assigning threads in this group to cgroups. Not owned.
Definition at line 193 of file thread.h.
Referenced by SetCgroupsMgr().
|
private |