1、创建锁
a、特点
私有、静态、只读的对象
b、语法
private static readonly object objLock = new object();
2、使用锁
lock(objLock){ // 需要锁的代码块 }