Comments (10)
https://github.com/Qihoo360/slash/blob/95c3c6313b7b360490cd5d6673f2519e48452c4f/slash/src/slash_mutex.cc#L178-L180
如果是最后一个引用就从records_
中删除了
在Lock里面也就不会找到这个ref_mutex了
from slash.
map的锁在是ref_mutex->Lock()之前被 unlock的, 理伦上还是有可能先earse + unref后又调用了Lock
from slash.
确实会。。额
from slash.
Lock()、Unlock()一般是在同一线程中按顺序使用,现实中不会发生Unlock(key)在Lock(key)之前的情况。
from slash.
@DavidLiuXh 我擦,老司机看slash,硬广:推荐看https://github.com/KernelMaker/rocksutil
from slash.
@KernelMaker 本来打算打Pink, 发现里面还用了slash
from slash.
@gaodq 公共接口的没法预测是不是在同一线程里, 要是同一线程应该都不用lock了吧.
from slash.
一个线程里的lock unlock操作不都应该是成对出现的吗
from slash.
@gaodq 没错, 所以在lock unlock这个操作可能同时出现在两个thread里,理伦上还是有可能先earse + unref后又调用了Lock
from slash.
ref_mutex指向的是一个key的锁,如果是同一个key,在两个thread里操作不会有问题,因为都是先lock;如果是不同的key那更不会存在问题了,因为操作的是不同的ref_mutex
from slash.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slash.