diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2012-08-28 15:47:35 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-09-21 02:44:22 +0200 |
commit | e92313bf7e2346f44deec4dd4ea70289a621c4ca (patch) | |
tree | 0bffbf156bcc95bfcb3d3181192218c4d64b6398 /src/corelib/thread/qmutex_p.h | |
parent | f4d47945ba17db276e94046473816014ed0342e9 (diff) | |
download | qtbase-e92313bf7e2346f44deec4dd4ea70289a621c4ca.tar.gz |
Add comments to document the internals of QMutex
Change-Id: Ieb5632017e5e8e09a11dc6b929efa19b4f350086
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread/qmutex_p.h')
-rw-r--r-- | src/corelib/thread/qmutex_p.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/corelib/thread/qmutex_p.h b/src/corelib/thread/qmutex_p.h index 6d84732751..5ae1ab7c80 100644 --- a/src/corelib/thread/qmutex_p.h +++ b/src/corelib/thread/qmutex_p.h @@ -2,6 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Copyright (C) 2012 Intel Corporation +** Copyright (C) 2012 Olivier Goffart <ogoffart@woboq.com> ** Contact: http://www.qt-project.org/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -113,8 +114,12 @@ public: void release(); static QMutexPrivate *allocate(); - QAtomicInt waiters; //number of thread waiting - QAtomicInt possiblyUnlocked; //bool saying that a timed wait timed out + QAtomicInt waiters; // Number of threads waiting on this mutex. (may be offset by -BigNumber) + QAtomicInt possiblyUnlocked; /* Boolean indicating that a timed wait timed out. + When it is true, a reference is held. + It is there to avoid a race that happens if unlock happens right + when the mutex is unlocked. + */ enum { BigNumber = 0x100000 }; //Must be bigger than the possible number of waiters (number of threads) void derefWaiters(int value) Q_DECL_NOTHROW; |