Ben, thanks for your response. Follow-up questions below:

> 2. Must foreground tasks be run with the isolate lock held? 
>
> ...yes, you have to hold the lock. 
>

Hmm, I just noticed that v8::platform::DefaultPlatform doesn't acquire the 
lock to run foreground tasks. On the other hand, the V8 samples never run 
scripts and foreground tasks concurrently, so it's unclear whether doing so 
is safe. Also, if holding the lock is a practical requirement, then how 
would you deal with long-running scripts? Would it make sense to implement 
CallOnForegroundThread() via v8::Isolate::RequestInterrupt()?
 

> For background tasks, just flush your background task queue.  I'd 
> probably opt for flushing both queues before you tear down the 
> isolate, just to be on the safe side.
>

Currently I don't have a background task queue; my implementation of 
CallOnBackgroundThread() simply posts a work item to the OS thread pool, 
but looking at what the work items actually do, I don't see how that can be 
safe. In any case, when you say "flush your background task queue", do you 
mean wait until all background tasks are finished executing? That seems 
like it could be a long wait if multiple isolates are concurrently posting 
new background tasks.

Thanks.

-- 
-- 
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