Giter Club home page Giter Club logo

Comments (3)

YoghurtFree avatar YoghurtFree commented on July 21, 2024

代码中 并没有用sync.RWMutex锁的特性 这样反而会引起歧义,还不如直接用sync.Mutex更清晰

q010这个实现就有问题啊,你开多个goroutine去write,会直接panic,锁的问题用sync.RWMutex还是sync.Mutex无伤大雅,当然确实用sync.Mutex更加严谨一点。具体问题请看pull request最新的一条。希望作者也看一下,不合没关系,自己改一下也可以。

from interview-go.

lifei6671 avatar lifei6671 commented on July 21, 2024

这个地方最早考虑的是在读的时候用读锁,写的时候用写锁。写的不够严谨。

from interview-go.

voctior avatar voctior commented on July 21, 2024

代码中 并没有用sync.RWMutex锁的特性 这样反而会引起歧义,还不如直接用sync.Mutex更清晰

q010这个实现就有问题啊,你开多个goroutine去write,会直接panic,锁的问题用sync.RWMutex还是sync.Mutex无伤大雅,当然确实用sync.Mutex更加严谨一点。具体问题请看pull request最新的一条。希望作者也看一下,不合没关系,自己改一下也可以。

赞 👍

from interview-go.

Related Issues (20)

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.