CHM: move critical sections from CHMlib into ChmModel (also protects the data cache)