Folly Code Review
folly::EventBase 분석 — libevent 이벤트 루프의 핵심
EventBase는 libevent의 event_base를 wrap한 단일 thread event loop. file descriptor, timer, cross-thread message를 한 번에 처리한다.
· 4분 읽기
cpp folly
6개의 포스트
EventBase는 libevent의 event_base를 wrap한 단일 thread event loop. file descriptor, timer, cross-thread message를 한 번에 처리한다.
ManualExecutor는 schedule된 task를 자동 실행하지 않고 run()/drive() 호출 시점에만 진행한다. 비동기 코드의 단위 테스트에 결정성을 부여한다.
IOThreadPoolExecutor는 각 worker thread에 EventBase를 두어 libevent 기반 I/O와 timer를 처리한다.
CPUThreadPoolExecutor는 CPU 집약 작업을 위한 thread pool. priority queue, blocking queue, thread factory를 조합한다.
InlineExecutor는 add()의 caller thread에서 callback을 그 자리에서 실행한다. 테스트와 단축 경로에 적합하지만 production hot path에는 위험하다.
SemiFuture는 executor에 바인딩되지 않은 상태, Future는 바인딩 완료 상태. 이 구분이 라이브러리 API의 안전성을 만든다.