59得票3回答
类成员中的 std::mutex 与 std::recursive_mutex 的区别

我看到一些人厌恶recursive_mutex: http://www.zaval.org/resources/library/butenhof1.html 但是当考虑如何实现一个线程安全的类(受互斥保护)时,我觉得非常难以证明每个应该受互斥保护的方法都被保护,并且互斥锁最多只被锁定一次。...

8得票2回答
在Python中的@property速度开销

我正在尝试理解Python中@property装饰器的用途。具体而言,我使用类属性来设置一个类: class A(object): def __init__(self, x): self._x = x @property def x(self): ...