设计模式-11-同步型设计模式
同步型设计模式同步型设计模式同步型设计模式同步型设计模式常见同步型设计模式Scoped Lock设计模式Strategized Locking设计模式Thread-Safe Interface 设计模式Double-Checked Locking Optimization设计模式Scoped Lock设计模式设计模式The Scoped Locking C+ idiom ensures that a lock is acquired when control enters a scopeand released automatically when control leaves the scope, regardless of the return path fromthe scope.Strategized Locking设计模式设计模式The Strategized Locking design pattern parameterizes synchronization mechanisms thatprotect a components critical sections from concurrent access.Thread-Safe InterfaceThe Thread-Safe Interface design pattern minimizes locking overhead and ensures thatintra-component method calls do not incur self-deadlock by trying to reacquire a lock that isheld by the component already.Double-Checked Locking OptimizationThe Double-Checked Locking Optimization design pattern reduces contention andsynchronization overhead whenever critical sections of code must acquire locks in a threadsafemanner just once during program execution.