absl::Mutex annotations — clang thread-safety로 race를 컴파일 타임에
Part 6-05: ABSL_GUARDED_BY, ABSL_LOCKS_EXCLUDED, ABSL_EXCLUSIVE_LOCKS_REQUIRED — clang -Wthread-safety와 결합해 lock 누락을 정적 검출.
11개의 포스트
Part 6-05: ABSL_GUARDED_BY, ABSL_LOCKS_EXCLUDED, ABSL_EXCLUSIVE_LOCKS_REQUIRED — clang -Wthread-safety와 결합해 lock 누락을 정적 검출.
Part 6-04: absl::BlockingCounter와 absl::Barrier — N개 작업 완료 대기, N개 thread 동기 합류, fanout-fanin 패턴.
Part 6-03: absl::Notification — 한 번만 발생하는 이벤트를 위한 가벼운 signal primitive. atomic flag보다 안전, condition variable보다 단순.
Part 6-02: Mutex::Await로 함수형 condition을 정의해 condition_variable, notify, spurious wakeup 관용구를 모두 제거.
Part 6-01: absl::Mutex — std::mutex/shared_mutex 통합, contention profiler, deadlock 검출, fairness 정책.
PicoSpinLock — integer type의 한 bit을 lock으로 사용. 객체 안에 lock을 끼워 넣어 메모리 절약.
folly::RWSpinLock — spin-only reader-writer lock, 매우 짧은 critical section에 SharedMutex보다 빠르다.
folly::Baton — 한 번 post, 한 번 wait의 경량 signal primitive. condition variable보다 가볍다.
folly::SharedMutex — std::shared_mutex보다 작고 빠른 reader-writer lock, fairness 정책 선택.
folly::Synchronized<T> — 데이터와 lock을 한 객체에 묶어 잠금 누락을 컴파일 타임에 막는다.
공유 자원 보호의 3가지 도구로 interrupt disable, spinlock, mutex가 있습니다. 언제 어느 것을 쓰는지 정리합니다.