0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

some sm internal locking

This commit is contained in:
Eliot Horowitz 2009-08-05 13:30:55 -04:00
parent d223c26df9
commit b1793eae5b

View File

@ -12,6 +12,8 @@
namespace mongo {
boost::thread_specific_ptr<SMScope> currentScope( dontDeleteScope );
mutex smmutex;
#define smlock boostlock ___lk( smmutex );
#define GETHOLDER(x,o) ((BSONHolder*)JS_GetPrivate( x , o ))
@ -819,6 +821,7 @@ namespace mongo {
class SMScope : public Scope {
public:
SMScope(){
smlock;
_context = JS_NewContext( globalSMEngine->_runtime , 8192 );
_convertor = new Convertor( _context );
massert( "JS_NewContext failed" , _context );
@ -848,6 +851,7 @@ namespace mongo {
}
~SMScope(){
smlock;
uassert( "deleted SMScope twice?" , _convertor );
for ( list<void*>::iterator i=_roots.begin(); i != _roots.end(); i++ ){