/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// A MutexId secifies the name and mutex order for a mutex. // // The mutex order defines the allowed order of mutex acqusition on a single // thread. Mutexes must be acquired in strictly increasing order. Mutexes with // the same order may not be held at the same time by that thread. struct MutexId { constchar* name;
uint32_t order;
};
// The Mutex class below wraps mozilla::detail::MutexImpl, but we don't want to // use public inheritance, and private inheritance is problematic because // Mutex's friends can access the private parent class as if it was public // inheritance. So use a data member, but for Mutex to access the data member // we must override it and make Mutex a friend. class MutexImpl : public mozilla::detail::MutexImpl { protected:
MutexImpl() {}
friendclass Mutex;
};
// In debug builds, js::Mutex is a wrapper over MutexImpl that checks correct // locking order is observed. // // The class maintains a per-thread stack of currently-held mutexes to enable it // to check this. class Mutex { private:
MutexImpl impl_;
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.