0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

use regular new rather than replacement new in mongo::mutex

This commit is contained in:
Aaron 2010-03-29 22:52:17 -07:00
parent e339760675
commit 19e879c509

View File

@ -287,10 +287,10 @@ namespace mongo {
// destroying them. // destroying them.
class mutex : boost::noncopyable { class mutex : boost::noncopyable {
public: public:
mutex() { new (_buf) boost::mutex(); } mutex() { _m = new boost::mutex(); }
~mutex() { ~mutex() {
if( !__destroyingStatics ) { if( !__destroyingStatics ) {
boost().boost::mutex::~mutex(); delete _m;
} }
} }
class scoped_lock : boost::noncopyable { class scoped_lock : boost::noncopyable {
@ -301,8 +301,8 @@ namespace mongo {
boost::mutex::scoped_lock _l; boost::mutex::scoped_lock _l;
}; };
private: private:
boost::mutex &boost() { return *( boost::mutex * )( _buf ); } boost::mutex &boost() { return *_m; }
char _buf[ sizeof( boost::mutex ) ]; boost::mutex *_m;
}; };
typedef mongo::mutex::scoped_lock scoped_lock; typedef mongo::mutex::scoped_lock scoped_lock;