Code Monkey home page Code Monkey logo

no-deadlocks's People

Contributors

michaelsippel avatar p-avital avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

michaelsippel

no-deadlocks's Issues

no_deadlock not work with threads

no_deadlocks seems wrongly judge about deadlock when deal with threads, here is the test code.

use std::time::Duration;
use std::sync::Arc;

// the test code run alright
// use std::sync::Mutex;

// no_deadlocks report deadlock error
use no_deadlocks::prelude::*;

fn main() {
    let mut childs = vec![];
    let m = Arc::new(Mutex::new(0));
    for _ in 1..=10 {
        let clone_m = m.clone();
        childs.push(std::thread::spawn(move||{
            let mut m = clone_m.lock().unwrap();
            std::thread::sleep(std::time::Duration::from_secs(1));
            *m = 1;
        }))
    }
    for c in childs.into_iter() {
        c.join();
    }
}

std::default::Default not implemented for no-deadlocks::Mutes

hey, this package is pretty awesome!
I tried both this and parking_lot, but I love how you keep the original lock stack frame also. (for re-entrancy issues)

I discovered in moving some code from std::sync::Mutex to this, that std::default::Default is not
implemented on the Mutex here.

Let me know if you'd like a PR, I'm pretty new to Rust, but think I might be able to hack this.

Analyze after Timeout

If I understand it correctly, everytime a lock could not be taken the analyze() function is called. This is probably responsible for the huge slowdown. Maybe it is possible to analyze the graph only after for a certain (configurable) time the lock could not be taken?
Currently I'm not successful in reproducing my deadlock.

unwrap panics in handle_deadlock

Sometimes (3 out of 20 times cargo test) it happens that requests.get(...).unwrap() in handle_deadlock panics:

test lock_manager::with_deadlock ... FAILED

failures:

---- lock_manager::with_deadlock stdout ----
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', src/lock_manager.rs:226:102
note: test did not panic as expected

failures:
    lock_manager::with_deadlock


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.