I've been wondering if it's possible to concurrently use v8::Locker.

I'm binding to v8 from a single-threaded language that uses fibers for 
concurrency (Crystal.) Since it's a single thread, v8::Locker is always 
instantly available.

This seems fine, the bigger issue if with Context::Scope.

I'm concurrently entering and exiting the same context from multiple fibers 
and I keep stumbling upon:

#
# Fatal error in v8::Context::Exit()
# Cannot exit non-entered context
#

Which came to make sense to me. I'm passing around a pointer to a 
Persistent<Context>. In the function I concurrently access, I'm getting the 
Local from it (with the isolate) and creating a Context::Scope. The same 
Local<Context> might be exited more than once. I expect Enter is a noop if 
the Context has already been entered.

My fix was to use a fiber-safe mutex to only allow one isolate locking and 
context scoping at any given time.

Is this normal? Any way around it?

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

Reply via email to