proxygen
folly::ThreadPoolListHook Class Reference

#include <GlobalThreadPoolList.h>

Public Member Functions

 ThreadPoolListHook (std::string name)
 
 ~ThreadPoolListHook ()
 
void registerThread ()
 
 ThreadPoolListHook (const ThreadPoolListHook &other)=delete
 
ThreadPoolListHookoperator= (const ThreadPoolListHook &)=delete
 

Private Member Functions

 ThreadPoolListHook ()
 

Detailed Description

A hook for tracking which threads belong to which thread pools. This is used only by a gdb extension to aid in debugging. You won't be able to see any useful information from within C++ code.

An instance of ThreadPoolListHook should be created in the thread pool class that you want to keep track of. Then, to register a thread you call registerThread() on your instance of ThreadPoolListHook from that thread.

When a thread exits it will be removed from the list When the thread pool is destroyed, it will be removed from the list

Definition at line 41 of file GlobalThreadPoolList.h.

Constructor & Destructor Documentation

folly::ThreadPoolListHook::ThreadPoolListHook ( std::string  name)
explicit

Name is used to identify the thread pool when listing threads.

Definition at line 205 of file GlobalThreadPoolList.cpp.

205  {
206  GlobalThreadPoolList::instance().registerThreadPool(this, name);
207 }
std::string name
folly::ThreadPoolListHook::~ThreadPoolListHook ( )

Definition at line 209 of file GlobalThreadPoolList.cpp.

209  {
210  GlobalThreadPoolList::instance().unregisterThreadPool(this);
211 }
folly::ThreadPoolListHook::ThreadPoolListHook ( const ThreadPoolListHook other)
delete
folly::ThreadPoolListHook::ThreadPoolListHook ( )
private

Member Function Documentation

ThreadPoolListHook& folly::ThreadPoolListHook::operator= ( const ThreadPoolListHook )
delete
void folly::ThreadPoolListHook::registerThread ( )

Call this from any new thread that the thread pool creates.

Definition at line 213 of file GlobalThreadPoolList.cpp.

Referenced by folly::IOThreadPoolExecutor::threadRun(), and folly::CPUThreadPoolExecutor::threadRun().

213  {
214  GlobalThreadPoolList::instance().registerThreadPoolThread(
215  this, std::this_thread::get_id());
216 }

The documentation for this class was generated from the following files: