I have a C++ which when invoked from JS will start a new thread and do
some processing. When completed, this thread would invoke a Function
which was passed as argument to the original function.
The function used for the new thread (pthread) is (simplified to just
sum values with delay and display it),
static void *execute(void *data) {
HandleScope scope;
ComputeData *cData = (ComputeData *) data;
Local<Value> val = Number::New(cData->a + cData->b);
sleep(2);
cout << val->NumberValue() << endl;
delete cData;
return NULL;
}
This piece of code prints nan instead of the actual sum. data is a
dynamically allocated pointer to a struct with the values to add.
What's wrong here? I've no prior V8 experience.
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users