priomutex: a mutex where waiting threads specify a priority
The API is very similar to std::sync::Mutex. The key difference, of course, is that lock() takes a priority. If multiple threads are waiting for the mutex when it's freed, the one which gave the highest priorty will recieve it.
impl<T> Mutex<T> {
fn new(data: T) -> Mutex<T>;
fn lock(&self, prio: usize) -> MutexGuard<T>;
fn try_lock(&self) -> Option<MutexGuard<T>>;
}
impl<T> Drop for MutexGuard<T>; // Releases the lock
impl<T> Deref for MutexGuard<T>; // For accessing your data
impl<T> DerefMut for MutexGuard<T>; // For accessing your data
Licence
Licensed under either of the following, at your option:
- Apache Licence 2.0 (see LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT licence (see LICENSE-MIT or http://opensource.org/licenses/MIT)
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.