mod_spidermonkey: suspend/resume ctx when sleeping

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16830 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Mathieu Rene 2010-02-25 21:22:41 +00:00
parent 1207c64a5a
commit 474ca2a9bd
1 changed files with 3 additions and 0 deletions

View File

@ -3380,7 +3380,10 @@ static JSBool js_api_sleep(JSContext * cx, JSObject * obj, uintN argc, jsval * a
}
if (msec) {
int saveDepth;
saveDepth = JS_SuspendRequest(cx);
switch_yield(msec * 1000);
JS_ResumeRequest(cx, saveDepth);
} else {
eval_some_js("~throw new Error(\"No Time specified\");", cx, obj, rval);
}