乐趣区

关于c++:Folly库代码赏析7Executor

Folly 的余下内容分为

    • [] synchronization
    • [] memory
    • [] logging
    • [] io
    • [] gen
    • [] fibers
    • [] executors
    • [] concurrency
classDiagram
    Executor
    Executor <|-- IOExecutor
    Executor <|-- ThreadPoolExecutor
    IOExecutor <|-- IOThreadPoolExecutor
    ThreadPoolExecutor <|--    IOThreadPoolExecutor
    ThreadPoolExecutor <|-- CPUThreadPoolExecutor
    Executor <|-- DrivableExecutor
    Executor <|-- ManualExecutor

Executor

KeepAlive是对 Executor 的平安援用,Executor析构时会 join 所有 KeepAlive 对象。

ThreadExecutor

对于每个 task 启动一个线程执行,通过 channel 告诉工作增加、删除、完结。golang中的select channel 用法。

ThreadPoolExecutor

IO/CPUThreadPoolExecutor的基类,提供了统计性能等通用信息。

IOThreadPoolExecutor

提供多个 ioThread,每个ioThread 容许event_base loop

退出移动版