boost库 学习笔记一 boost::share_mutex 互斥锁 读写锁

#include <boost/thread/mutex>



typedef boost::shared_mutex  rwMutex;



typedef boost::shared_lock<rwMutex>  ReadLocker;
typedef boost::unique_lock<rwMutex>  WriteLocker;   //读写锁


typedef boost::unique_lock<rwMutex>  exclusiveLock;  //互斥锁



boost::share_ptr   引用计数型智能指针

boost::share_ptr<int>   m_str(new int(5));

boost::share_ptr<char> p_chr(new char[MAX_PATH]);

memset(p_chr.get(), 0, MAX_PATH);

strcpy(p_chr.get(), "strung");



你可能感兴趣的:(boost库 学习笔记一 boost::share_mutex 互斥锁 读写锁)