avatar
B 家 电话题 C++# JobHunting - 待字闺中
a*r
1
估计是临时想出了这个题的。
写一个跟smart pointer 类似的mutex class, 忘记unlock也没风险了
avatar
r*l
2
B家又是什么玩意?

【在 a********r 的大作中提到】
: 估计是临时想出了这个题的。
: 写一个跟smart pointer 类似的mutex class, 忘记unlock也没风险了

avatar
b*5
3
bloomberg

【在 r******l 的大作中提到】
: B家又是什么玩意?
avatar
r*g
4
好难,什么东西
avatar
a*r
5
他说C++ pointer 忘记 delete 了就会 memory leaking
mutex 忘记 unlock 了就会 deadlock
smart pointer 可以自动 delete
他要我写一个类似的 smart mutex

【在 r*******g 的大作中提到】
: 好难,什么东西
avatar
f*y
6
这个不就是在destructor 检查加锁层次,如果是0就自动解锁吗?

好难,什么东西

【在 r*******g 的大作中提到】
: 好难,什么东西
avatar
b*5
7
what destructor??!!
it's for mutex. let's say ppl forgot to unlock a lock, the key here is when
to unlock that lock automatically.

【在 f********y 的大作中提到】
: 这个不就是在destructor 检查加锁层次,如果是0就自动解锁吗?
:
: 好难,什么东西

avatar
y*g
8
那不就是destructor吗???

when

【在 b**********5 的大作中提到】
: what destructor??!!
: it's for mutex. let's say ppl forgot to unlock a lock, the key here is when
: to unlock that lock automatically.

avatar
c*e
9
RAII

【在 a********r 的大作中提到】
: 估计是临时想出了这个题的。
: 写一个跟smart pointer 类似的mutex class, 忘记unlock也没风险了

avatar
M*i
10
create an class wrapping up on the mutex. unlock this mutex in the
destructor of the class.
Whenever the application uses the mutex, it create object of this class
instead of using mutex directly. Then the destructor will unlock the mutex
automatically.

when

【在 b**********5 的大作中提到】
: what destructor??!!
: it's for mutex. let's say ppl forgot to unlock a lock, the key here is when
: to unlock that lock automatically.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。