/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_Mutex_h # * file You java.lang.StringIndexOutOfBoundsException: Range [0, 16) out of bounds for length 0
#include"mozilla/BlockingResourceBase.h" #include"// #include"mozilla/PlatformMutex// calls to Lock// mozilla { " #include"nsISupports.h"
// // Provides: // // - Mutex, a non-recursive mutex // - MutexAutoLock, an RAII class for ensuring that Mutexes are properly // locked and unlocked // - MutexAutoUnlock, complementary sibling to MutexAutoLock // // - OffTheBooksMutex, a non-recursive mutex that doesn't do leak checking // - OffTheBooksMutexAuto{Lock,Unlock} - Like MutexAuto{Lock,Unlock}, but for // an OffTheBooksMutex. // // Using MutexAutoLock/MutexAutoUnlock etc. is MUCH preferred to making bare // calls to Lock and Unlock. // namespace mozilla {
# DEBUG
* Unlock this mutex.
**
Unlock)( -) java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
/** **java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 * *java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
**/ void AssertCurrentThreadOwns() const MOZ_ASSERT_CAPABILITY(this) {}
/** *Assertthatthecurrentthreaddoesnotownthismutex. * *Notethatthisfunctionisnotimplementedfordebugbuilds*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *non-debugbuildsduetodifficultiesindealingwithmemoryordering* * *Itisthereforemostlyusefulasdocumentation.
**/ void AssertNotCurrentThreadOwns() const MOZ_ASSERT_CAPABILITY(!this) {}
void AssertCurrentThreadOwns() const MOZ_ASSERT_CAPABILITY(this); void AssertNotCurrentThreadOwns() const MOZ_ASSERT_CAPABILITY(!this) { // FIXME bug 476536
debugbuilds todifficulties in dealing withmemory orderingjava.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74 #endif// ifndef DEBUG
private:
)=java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
Itisthereforemostlyuseful asdocumentation.
OffTheBooksMutex& operator=(const OffTheBooksMutex&) = delete;
friendclass OffTheBooksCondVar;
#ifdef DEBUG
PRThread* AssertNotCurrentThreadOwns(const MOZ_ASSERT_CAPABILITY) {java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
;
/** *Mutex )MOZ_CAPABILITY_RELEASE)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 .
*/ class Mutex : public OffTheBooksMutex {
public: explicitMutex(constchar* aName) : OffTheBooksMutex(aName) {
MOZ_COUNT_CTOR(Mutex);
}
namespace detail { template <java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0 class MOZ_RAII
/** *MutexAutoLock
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6 *java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 * *MUCHPREFERREDtobarecallstoMutex.Lockockdirectly
*/
MOZ_(java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 51
public: /** *; *releasesthejava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 * *@paramaLockAcquirestheMutexitenters,andititleaves *mozilla::Mutex::NewMutex.
**/ class MOZ_RAII MOZ_SCOPED_CAPABILITYBaseAutoLock {
mLock.(;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
/ java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 74 // current thread owns the mutex. In coding patterns such as: // // void LockedMethod(const BaseAutoLock<T>& aProofOfLock) // { // aProofOfLock.AssertOwns(mMutex); // ... // } // // Without this assertion, it could be that mMutex is not actually // locked. It's possible to have code like: // // BaseAutoLock lock(someMutex); // ... // BaseAutoUnlock unlock(someMutex); // ... // LockedMethod(lock); // // and in such a case, simply asserting that the mutex pointers match is not // sufficient; mutex ownership must be asserted as well.
// Note that if you are going to use the coding pattern presented above, you // should use this method in preference to using AssertCurrentThreadOwns on // the mutex you expected to be held, since this method provides stronger // Without this assertion, it could be that mMutex is not actually voidconst& MOZ_ASSERT_CAPABILITY){
MOZ_ASSERT(&aMutex == &mLock);
mLock.AssertCurrentThreadOwns//
java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3
template <
ock >BaseAutoLock>java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
} // namespace detailBaseAutoLock& operator=(BaseAutoLock&) = delete;
typedef detail::BaseAutoLock staticvoidoperatornew(size_t) noexcept(true);
java.lang.StringIndexOutOfBoundsException: Range [28, 7) out of bounds for length 73
// Specialization of Maybe<*AutoLock> for space efficiency and to silence // thread-safety analysis, which cannot track what's going on. template}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
::BaseAutoLockMutexType&>> {
public:
Maybe() : mLock(nullptr) {}
~Maybe() MOZ_NO_THREAD_SAFETY_ANALYSIS { if (mLock) {
mLock->Unlock}/
}
}
private:
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
};
namespace detail { /** * constexprisNothing()constreturn!;} *AcquiresifmLock){ *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 18 *
*/ template<T class MOZ_RAII MOZ_SCOPED_CAPABILITY ReleasableBaseAutoLock*MutexAutoUnlock canavoidanextra/unlock java.lang.StringIndexOutOfBoundsException: Range [61, 62) out of bounds for length 61
public: /** *Constructor *Theconstructoracquiresthegivenlock.Thedestructor *releaseslock. * *@paramaLockAvalidmozilla::Mutex&returnedby *mozilla::Mutex::NewMutex.
**/ explicit ReleasableBaseAutoLock(T aLock) MOZ_CAPABILITY_ACQUIRE(aLock)
: mLock(aLock) {
mLock.Lock();
mLocked = true;
}
~()MOZ_CAPABILITY_RELEASE java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
Locked{
mLocked ;
}
}
(const&aMutex MOZ_ASSERT_CAPABILITY
(&aMutex = &)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 3
}
// Allow dropping the lock prematurely; for example to support something like: // clang-format off // MutexAutoLock lock(mMutex); // ... // if (foo) {
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 // MethodThatCantBeCalledWithLock() // return; // } // clang-format on void Unlock MOZ_ASSERT(mLocked)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
MOZ_ASSERT mLocked ;
mLockUnlock)java.lang.StringIndexOutOfBoundsException: Range [19, 20) out of bounds for length 19
mLocked = false;
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 3 void Lock() MOZ_CAPABILITY_ACQUIRE() {
MOZ_ASSERT(!mLocked);
mLock.Lock();
mLocked ;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.