QReadLocker unlock question
Solved
QML and Qt Quick
-
I have some code like this, but I do not know if
readLocker.unlock();
is safe or not.
thanks for advice.QReadLocker readLocker(&locker); Login login(name, password); if (!login.isLoggedIn()) { return false; } readLocker.unlock(); onUserChanged(); //signal
-
QReadLocker::unlock()
call will unlock/release the lock.QReadLocker
out-of-scope destructor will unlock/release the lock if it holds a lock. You should assume if it has already unlocked/released it will not do it a second time.
Did you actually try your code? Since you seem to be so worried about it, and are not comfortable with answers, why don't you do so to reassure yourself at this point?
-