[webkit-dev] JavascriptCore and Multiple Threads

Geoffrey Garen ggaren at apple.com
Wed May 18 13:54:46 PDT 2011


Hi Martijn.

> i selected JavascriptCore over the competition because i read that
> it's thread safe.

Yes, with certain restrictions, JavaScriptCore can be used concurrently on multiple threads.

> but, i can't get it to work from within threads with crashing.

It's hard to diagnose exactly what's going on without looking at your code, but I can give you these general guidelines:

(1) A JSGlobalContextGroup roughly corresponds to a virtual machine or a process. Multiple JSGlobalContextGroups can run concurrently on separate OS threads. Data cannot be shared between JSGlobalContextGroups.

(2) A JSGlobalContext belongs to a JSGlobalContextGroup, and roughly corresponds to a thread or module. Multiple JSGlobalContexts in the same JSGlobalContextGroup can shared data. Multiple JSGlobalContexts in the same JSGlobalContextGroup cannot run concurrently on separate OS threads, but can run with explicit locking on separate OS threads.

Geoff


More information about the webkit-dev mailing list