The Synchronizing a block of code with a lock and Synchronizing data access with read/write locks recipes in this chapter