summaryrefslogtreecommitdiff
path: root/scripting/engine.h
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2011-12-15 10:02:19 +0100
committerAntonin Kral <a.kral@bobek.cz>2011-12-15 10:02:46 +0100
commit0b48f8ada2acb0de830b23f8cefc8e3fea28d915 (patch)
treef7c2811269b6b53199412be2dd5ec02eea15d55d /scripting/engine.h
parent85f1cd56145b90a32b7ccdc750000deeed54fe22 (diff)
parentf0d9a01bccdaeb466c12c92057914bbfef59526c (diff)
downloadmongodb-0b48f8ada2acb0de830b23f8cefc8e3fea28d915.tar.gz
Merge branch 'upstream/2.0.2'
Diffstat (limited to 'scripting/engine.h')
-rw-r--r--scripting/engine.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripting/engine.h b/scripting/engine.h
index 1f9f1f5..9dd5f1d 100644
--- a/scripting/engine.h
+++ b/scripting/engine.h
@@ -132,6 +132,11 @@ namespace mongo {
static void validateObjectIdString( const string &str );
+ /** increments the number of times a scope was used */
+ void incTimeUsed() { ++_numTimeUsed; }
+ /** gets the number of times a scope was used */
+ int getTimeUsed() { return _numTimeUsed; }
+
protected:
virtual ScriptingFunction _createFunction( const char * code ) = 0;
@@ -141,6 +146,7 @@ namespace mongo {
set<string> _storedNames;
static long long _lastVersion;
map<string,ScriptingFunction> _cachedFunctions;
+ int _numTimeUsed;
static int _numScopes;
};
@@ -168,7 +174,12 @@ namespace mongo {
static void setup();
+ /** gets a scope from the pool or a new one if pool is empty
+ * @param pool An identifier for the pool, usually the db name
+ * @return the scope */
auto_ptr<Scope> getPooledScope( const string& pool );
+
+ /** call this method to release some JS resources when a thread is done */
void threadDone();
struct Unlocker { virtual ~Unlocker() {} };