Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MutexLockGuard 完全不对 #2

Open
liuhongran626 opened this issue May 31, 2023 · 0 comments
Open

MutexLockGuard 完全不对 #2

liuhongran626 opened this issue May 31, 2023 · 0 comments

Comments

@liuhongran626
Copy link

class MutexLockGuard : public noncopyable { public: explicit MutexLockGuard(MutexLock &mutex) : m_mutex(m_mutex) { m_mutex.lock(); } ~MutexLockGuard(){ m_mutex.unlock(); } private: MutexLock m_mutex; };
首先,构造函数的mutex完全没用到,其次m_mutex无法被拷贝初始化,需要把m_mutex改为引用类型
各种错误,不知道怎么编译通过的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant