0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +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.
class mutex : boost::noncopyable {
public:
mutex() { new (_buf) boost::mutex(); }
mutex() { _m = new boost::mutex(); }
~mutex() {
if( !__destroyingStatics ) {
boost().boost::mutex::~mutex();
delete _m;
}
}
class scoped_lock : boost::noncopyable {
@ -301,8 +301,8 @@ namespace mongo {
boost::mutex::scoped_lock _l;
};
private:
boost::mutex &boost() { return *( boost::mutex * )( _buf ); }
char _buf[ sizeof( boost::mutex ) ];
boost::mutex &boost() { return *_m; }
boost::mutex *_m;
};
typedef mongo::mutex::scoped_lock scoped_lock;