On Fri, May 11, 2018 at 10:05 PM, <jer...@fly.io> wrote: > Yea, that makes sense. They do match up, but the function I use to get the > context handle may be called more than once at the same time. I mean, the > same context may be entered multiple times concurrently and exited at > different times. As soon as it's exited once by one of the concurrent tasks, > it will throw that error I pasted if it's exited again. > > void __crystal_ctx_scoped(char *id); > > void v8_with_ctx_scope(Isolate* iso, Context* ctxptr, char* id) { > v8::HandleScope handle_scope(iso); > v8::Local<v8::Context> ctx = ctxptr->Get(iso); > { > v8::Context::Scope context_scope(ctx); > __crystal_ctx_scoped(id); > } > } > > The __crystal_ctx_scoped is a callback exposed from Crystal to C. It > dispatches to the right context via the provided id.
You mean __crystal_ctx_scoped() directly or indirectly calls v8_with_ctx_scope() again? Yes, that's going to be problematic. At what point or points do you call into V8? You could maintain a stack of contexts and call Enter() and Exit() manually but that only works when there are no V8 stack frames (either JS or C++) on the call stack. -- -- 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.