Coder Social home page Coder Social logo

haogrgr / haogrgr-test Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 3.0 773 KB

用于一些简单的测试用的项目,比如实现某一算发,测试某框架新特性,等等...

License: Apache License 2.0

Java 95.57% JavaScript 3.64% CSS 0.15% HTML 0.32% Batchfile 0.19% Shell 0.13%

haogrgr-test's People

Contributors

haogrgr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

haogrgr-test's Issues

cancelAcquire唤醒后继节点的条件

image
你好,在cancelAcquire的唤醒后继节点的3个条件,第一个条件我是理解的,
image

我想问一下,为什么第二个条件和第三个条件为什么要唤醒后继节点,第3个条件,pred.pthread != null, 为什么等于null的时候要唤醒?如果是设置为了头节点,为什么当前的cancel节点要去唤醒后继节点,为什么不是持有锁的线程释放锁的时候来唤醒后继节点,如果是cancel节点,因为cancelAcquire一开始过滤cancel节点的时候,pred不是cancel,那么在底下的时候,如果pred的状态变为了cancel,那么已经说明当前线程不可能是pred唤醒的,因为pred醒来的时候,当前线程早已经醒了,所以不会是pred误唤醒了当前线程,还有会存在唤醒的可能是,正常释放锁的时候,会唤醒头节点,那么头节点如果是cancel,然后cancel有可能继续在接下来cancel节点醒来的时候,去唤醒他一次,但是如果是这种情况,那么当前节点在过滤cancel的时候,会过滤掉第一个节点,结果pred变为了head,这样又是不满足第一个条件 pred == head,结果走的不是pred.thread != null这个条件

关于第三个条件,pred.thread != null, 如果这个条件不成立,在release解锁的时候,会唤醒后面的线程,他会忽略cancel节点,所以为什么说唤醒链会断?

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.