Obsolete since JSAPI 18
This feature is obsolete. Although it is still supported by browsers, its usage is discouraged in new projects. Try to avoid using it.
Suspends the calling thread's current request, if any, to allow the thread to block or perform time-consuming calculations.
jsrefcount JS_SuspendRequest(JSContext *cx); void JS_ResumeRequest(JSContext *cx, jsrefcount saveDepth);
||The context whose current request is to be suspended or resumed.|
JS_THREADSAFE builds, when a multi-threaded application is in a request but needs to block or perform lengthy computation that can race safely with the garbage collector, it should call
JS_SuspendRequest before the time-consuming operation and
JS_ResumeRequest after. For more information about thread safety and requests, see
JS_SuspendRequest suspends any currently active requests associated with the context
cx. This allows the runtime to perform garbage collection if needed and allows other threads to access objects that the calling thread had locked. The return value is the number of nested requests that were suspended. It may be
JS_ResumeRequest resumes the previously suspended requests. The
saveDepth argument must be the value returned by the matching
JS_SuspendRequest call. If
saveDepth is nonzero and garbage collection is underway,
JS_ResumeRequest blocks until the garbage collector is done.
JSAPI 1.7 and earlier
JS_ResumeRequest are available only in
JS_THREADSAFE builds. In SpiderMonkey 1.8 and later, these functions will be present, but will do nothing, in non-