Creating and locking Isolates

45 views
Skip to first unread message

Nozik

unread,
Apr 22, 2014, 10:50:16 AM4/22/14
to v8-u...@googlegroups.com
Hi all,

I've upgraded an old V8 to an updated version and encountered the following problem:

I'm creating Isolates several times in the code, and then calling the Locker. 

_isolate = Isolate::New();
_isolate->Enter();
Locker lock(_isolate);
Isolate::Scope isolateScope(_isolate);

However I sometimes get an access violation exception in the Locker constructor, which doesn't make any sense, since I've just created the isolate...

My questions are:
1. Why am I getting these exceptions?
2. Do I really need to use Enter() after creating the isolate? Is that the way to control which Isolate is returned when calling Isolate::GetCurrent()?
3. Generally, what are the precautions to be taken when using the same Isolate in different threads?

Thanks.

Dmitry Lomov

unread,
Apr 22, 2014, 11:15:50 AM4/22/14
to v8-u...@googlegroups.com
You should always enter isolates _after_ you acquired a lock on it, not before. 
You do not need to use Enter directly: Isolate::Scope is RIAA-style wrapper around Isolate::Enter/Exit.

HTH,
Dmitry


--
--
v8-users mailing list
v8-u...@googlegroups.com
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 v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nozik

unread,
Apr 22, 2014, 12:25:06 PM4/22/14
to v8-u...@googlegroups.com
Thanks Dmitry, but the problem happens even when I'm not calling Enter before acquiring the lock.

Any other ideas?

Thanks.

Dmitry Lomov

unread,
Apr 23, 2014, 5:39:50 AM4/23/14
to v8-u...@googlegroups.com
Hard to say without more information. Debug it?
Reply all
Reply to author
Forward
0 new messages