如果只需要简单的资源保护,而不需要复杂的锁策略,可以选择使用std::mutex;如果需要在同一线程内递归调用,可以使用std::recursive_mutex;如果需要等待一段时间来获取锁,可以使用带超时功能的锁等