Hi!

I'm trying to develop a program using threads. According to the things I've 
read, the way I can create a critical section in my code is by using 
"isolate" and "locker".

I will show you my code below, so you can see what I'm trying to do.
Sadly, this line "v8::Handle<Value> notifyFrameEvent_val = 
context_->Global()->Get(notifyFrameEvent_name)" is getting a segmentation 
fault, so I'm confuse about how I should use isolate, locker and context.

Thanks in advance,

Vero


*
**void notifyFrameEvent()
{
    v8::Isolate* isolate = v8::Isolate::New();
    Persistent<v8::Context> context;
    {
        v8::Locker locker(isolate);
        v8::Isolate::Scope isolate_scope(isolate);

        isolate->Enter();
        // Create a handle scope to keep the temporary object references.
            v8::HandleScope handle_scope;
            
          // Enter the new context so all the following operations take 
place within it.
            v8::Context::Scope context_scope(context_);
            
            v8::Handle<String> notifyFrameEvent_name = 
v8::String::New("notifyFrameEvent");
            
            v8::Handle<Value> notifyFrameEvent_val = 
context_->Global()->Get(notifyFrameEvent_name);
            
        // If there is no notifyFrameEvent function, or if it is not a 
function, bail out
            if (!notifyFrameEvent_val->IsFunction()){
                while (v8::Isolate::GetCurrent() == isolate) {
                        isolate->Exit();
                }
                isolate->Dispose();
                return ;
            }
            
        //Obtain the notifyFrameEvent
            notifyFrameEvent_= getNotifyFrameEvent();
    
        // Wrap the C++ request object in a JavaScript wrapper

        // Set up an exception handler before calling the Process function
            TryCatch try_catch;
        
        // Invoke the process function, giving the global object as 'this' 
and one argument, the request.
            const int argc =0;
    
            v8::Handle<Value> argv[argc]={};
    
            v8::Handle<Value> result = 
notifyFrameEvent_->Call(context_->Global(), argc, argv);
            
            if (result.IsEmpty()) {
                String::Utf8Value error(try_catch.Exception());
                ScriptingGeneral *sg= new ScriptingGeneral();
                sg->Log(*error);
            }
    
            while (v8::Isolate::GetCurrent() == isolate) {
                isolate->Exit();
            }
            isolate->Dispose();
    }
    return;

}*

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to