《Folly库代码赏析》7):Executor

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

你可能感兴趣的:(c++)