[webkit-dev] asynchronous function question
Jack Wootton
jackwootton at gmail.com
Mon Jun 8 06:25:08 PDT 2009
Hi all,
Assuming I have a JS function:
<script>
x();
</script>
And it has a corresponding C implementation, by setting
JSObjectCallAsFunctionCallback. The C function has the following
signature:
JSValueRef X_imp(JSContextRef ctx,
JSObjectRef function,
JSObjectRef thisObject,
size_t argumentCount,
const JSValueRef arguments[],
JSValueRef *exception);
My question surrounds making the JavaScript call asynchronous.
In order to make the JS call to x(); asynchronous then the C function
X_imp must return a JSValueRef (even if it's null) before any
calculations are actually complete. However returning from the
function would mean that all parameters provided to X_imp are no
longer accessible, indeed the function has finished executing, so any
variables created inside X_impl be removed from the stack. For this
reason I can't see how spawning a new thread or creating any objects
inside X_imp would help in the implementation of making x();
asynchronous.
If a new thread was spawned inside X_imp, then there still seems to be
a problem because X_imp must still return / complete.
--
Regards
Jack
More information about the webkit-dev
mailing list