C++多线程安全原则


对象析构很复杂,我们采用shared_ptr和weak_ptr来做

enable_shared_from_this<>是用来做回调的,因为多线程中可能对象的生命周期比传出去的this指针短,同时为了不延长对象的生命周期,我们把shared_ptr转成weakptr.
对象析构很复杂,我们采用shared_ptr和weak_ptr来做
enable_shared_from_this<>是用来做回调的,因为多线程中可能对象的生命周期比传出去的this指针短,同时为了不延长对象的生命周期,我们把shared_ptr转成weakptr.