mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-11 23:01:54 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user