proxygen
|
#include <PriorityThreadFactory.h>
Public Member Functions | |
PriorityThreadFactory (std::shared_ptr< ThreadFactory > factory, int priority) | |
std::thread | newThread (Func &&func) override |
Public Member Functions inherited from folly::ThreadFactory | |
virtual | ~ThreadFactory ()=default |
Private Attributes | |
std::shared_ptr< ThreadFactory > | factory_ |
int | priority_ |
A ThreadFactory that sets nice values for each thread. The main use case for this class is if there are multiple CPUThreadPoolExecutors in a single process, or between multiple processes, where some should have a higher priority than the others.
Note that per-thread nice values are not POSIX standard, but both pthreads and linux support per-thread nice. The default linux scheduler uses these values to do smart thread prioritization. sched_priority function calls only affect real-time schedulers.
Definition at line 38 of file PriorityThreadFactory.h.
|
inlineexplicit |
Definition at line 40 of file PriorityThreadFactory.h.
|
inlineoverridevirtual |
Implements folly::ThreadFactory.
Definition at line 45 of file PriorityThreadFactory.h.
References folly::errnoStr(), factory_, folly::gen::move, and priority_.
Referenced by TEST().
|
private |
Definition at line 57 of file PriorityThreadFactory.h.
Referenced by newThread().
|
private |
Definition at line 58 of file PriorityThreadFactory.h.
Referenced by newThread().