chrome中的加锁基类,去掉不用的部分
#pragma once
#define DISALLOW_COPY_AND_ASSIGN(TypeName) /
TypeName(const TypeName&); /
void operator=(const TypeName&)
class LockImpl
{
typedef CRITICAL_SECTION OSLockType;
public:
LockImpl(void);
virtual ~LockImpl(void);
// If the lock is not held, take it and return true. If the lock is already
// held by something else, immediately return false.
bool Try();
// Take the lock, blocking until it is available if necessary.
void Lock();
// Release the lock. This must only be called by the lock's holder: after
// a successful call to Try, or a call to Lock.
void Unlock();
// Debug-only method that will DCHECK() if the lock is not acquired by the
// current thread. In non-debug builds, no check is performed.
// Because linux and mac condition variables modify the unde