I know but i have problem with this:
        static void* thread_setTimeout( void * arg ) {
            v8::Locker locker(v8::Isolate::GetCurrent());
            v8::HandleScope handle_scope(v8::Isolate::GetCurrent());

            usleep( 1000000 );

            v8::Unlocker unlocker(v8::Isolate::GetCurrent());
        }

after run process is terminated by seg fault

0x00007ffff56c6b7f in v8::Locker::Initialize(v8::Isolate*) ()



W dniu czwartek, 8 września 2016 23:25:24 UTC+2 użytkownik Daniel Burchardt 
napisał:
>
> 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