Yes it does! Thanks a lot :) On Tue, Oct 11, 2011 at 4:35 PM, Yang Guo <yang...@chromium.org> wrote:
> Hi Adrian, > > you can use *either* Isolate::Enter and Isolate::Exit *or* use > Isolate::Scope to imply being inside the isolate while being in the > scope. If you look into isolate.h, you should also notice that you > need to have exited the isolate before disposing it. Besides that, I > think you need to have locked onto the isolate *before* entering an > handle scope. > > For a general example you should take a look at d8.cc which implements > the debugging shell of v8. The method void > SourceGroup::ExecuteInThread() shows how to execute a script inside an > isolate. I hope this helps. > > Cheers, > > Yang > > On Oct 11, 10:48 am, Adrian Basheer <adrianbash...@gmail.com> wrote: > > I am sorry for bothering you again.... I cannot seem to find any samples > to > > help me with my problem. Below is my failure, followed by a stack trace. > > > > It seems that v8 is failing to initialize, and I cannot understand > why.... > > > > I am linking with v8_base.lib and v8_snapshot.lib > > > > Thanks a lot for your time.. > > > > class TestThread : public Thread::Thread > > { > > public: > > TestThread(){}; > > void TestThread::run() > > { > > v8::Isolate *pIsolate = v8::Isolate::New(); > > pIsolate->Enter(); > > v8::Isolate::Scope isolate_scope(pIsolate); > > v8::HandleScope handle_scope; > > > > v8::Locker > > locker(pIsolate);//<-------------------------------------------------This > > fails > > > > v8::Handle<v8::String> test = v8::String::New("Hello"); > > > > pIsolate->Dispose(); > > } > > > > }; > > > > int main(int argc, const char* argv[]) > > { > > TestThread mythread; > > mythread.start(); > > mythread.waitDone(); > > > > } > > > > testUsingV8dll.exe!v8::internal::OS::DebugBreak() + 0x3 bytes > > testUsingV8dll.exe!v8::internal::OS::Abort() + 0x31 bytes > > testUsingV8dll.exe!_V8_Fatal() + 0xa0 bytes > > testUsingV8dll.exe!v8::internal::Deserializer::Allocate() + 0x23d > bytes > > testUsingV8dll.exe!v8::internal::Deserializer::Synchronize() + 0x36 > bytes > > testUsingV8dll.exe!v8::internal::Heap::IterateStrongRoots() + 0x3b > bytes > > testUsingV8dll.exe!v8::internal::Deserializer::Deserialize() + 0x109 > > bytes > > testUsingV8dll.exe!v8::internal::Isolate::Init() + 0x6d4 bytes > > testUsingV8dll.exe!v8::internal::V8::Initialize() + 0xf2 bytes > > testUsingV8dll.exe!v8::internal::Snapshot::Deserialize() + 0x3a bytes > > testUsingV8dll.exe!v8::internal::Snapshot::Initialize() + 0x68 bytes > > testUsingV8dll.exe!v8::internal::Factory::isolate() + 0xfa bytes > > testUsingV8dll.exe!v8::V8::Initialize() + 0x2a bytes > > testUsingV8dll.exe!v8::Locker::Locker() + 0x91 bytes > > > > > testUsingV8dll.exe!TestThread::run() Line 24 + 0xc bytes C++ > > > > On Mon, Oct 10, 2011 at 2:39 PM, Adrian Basheer <adrianbash...@gmail.com > >wrote: > > > > > > > > > > > > > > > > > Thanks a lot for your help :) > > > > > On Mon, Oct 10, 2011 at 2:20 PM, Vyacheslav Egorov < > vego...@chromium.org>wrote: > > > > >> You have to use Isolate::Enter or Isolate::Scope. > > > > >> If you want to use the default isolate just acquire isolate lock with > > >> Locker. > > > > >> v8.h includes very detailed comments. Please read them for further > > >> information: > > > > >>http://code.google.com/p/v8/source/browse/trunk/include/v8.h#3510 > > > > >> -- > > >> Vyacheslav Egorov > > > > >> On Mon, Oct 10, 2011 at 1:16 PM, Adrian Basheer < > adrianbash...@gmail.com>wrote: > > > > >>> Hi, > > > > >>> I am afraid I do not know how to enter an isolate (I don't remember > it > > >>> coming up in the v8 tutorial)... > > > > >>> Can you help me please? > > > > >>> Thanks! > > > > >>> Adrian. > > > > >>> On Mon, Oct 10, 2011 at 2:09 PM, Vyacheslav Egorov < > vego...@chromium.org > > >>> > wrote: > > > > >>>> You can not declare handle scope in a thread that does not yet own > V8 > > >>>> Isolate. You should enter an Isolate first. > > > > >>>> -- > > >>>> Vyacheslav Egorov > > > > >>>> On Mon, Oct 10, 2011 at 1:02 PM, Adrian <adrianbash...@gmail.com > >wrote: > > > > >>>>> Hi, > > > > >>>>> This is the exact, complete program, that is failing.. > > > > >>>>> class TestThread : public Thread::Thread > > > > >>>>> { > > > > >>>>> public: > > > > >>>>> TestThread(){}; > > > > >>>>> void TestThread::run() > > > > >>>>> { > > > > >>>>> v8::HandleScope scope;//<--This failes > > > > >>>>> } > > > > >>>>> }; > > > > >>>>> int main(int argc, const char* argv[]) > > > > >>>>> { > > > > >>>>> v8::HandleScope scope; //<--This works > > > > >>>>> TestThread mythread; > > > > >>>>> mythread.start(); > > > > >>>>> mythread.waitDone(); > > > > >>>>> } > > > > >>>>> -- > > >>>>> v8-users mailing list > > >>>>> v8-users@googlegroups.com > > >>>>>http://groups.google.com/group/v8-users > > > > >>>> -- > > >>>> v8-users mailing list > > >>>> v8-users@googlegroups.com > > >>>>http://groups.google.com/group/v8-users > > > > >>> -- > > >>> v8-users mailing list > > >>> v8-users@googlegroups.com > > >>>http://groups.google.com/group/v8-users > > > > >> -- > > >> v8-users mailing list > > >> v8-users@googlegroups.com > > >>http://groups.google.com/group/v8-users > > -- > v8-users mailing list > v8-users@googlegroups.com > http://groups.google.com/group/v8-users > -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users