Hi,

I try implement setTimeout in v8. I have problem: how i can execute js code 
in other thread in this same context? My code:

v8::Handle<v8::Value> setTimeoutImpl(const v8::FunctionCallbackInfo<v8::
Value>& info) {
            v8::Local<v8::Value> callback(info[0]);

            if (callback->IsFunction()) {
                v8::Handle<v8::Function> func = v8::Handle<v8::Function>::
Cast(callback);

                v8::Handle<v8::Value> args[0];
                v8::Handle<v8::Value> result;
                result = func->Call(info.GetIsolate()->GetCurrentContext()->
Global(), 0, args);

                info.GetReturnValue().Set(result);
            }
}

I try create new thread like that:
                pthread_t tid;
                pthread_attr_t tattr;
                pthread_attr_init(&tattr);
                pthread_attr_setdetachstate(&tattr, 
PTHREAD_CREATE_DETACHED);
                pthread_create(&tid, &tattr, thread_setTimeout, &ji);
                pthread_attr_destroy(&tattr);

but use v8 in thread is terminated with error segmentation fault... Any one 
can help me? I found example but use old api.

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to