2

Is it possible to share memory between several web workers for reading and writing(or at least for reading only) in the modern browsers? If not, are there plans to implement such feature?

I know that data may be transferred between workers by using message system, but such way sometimes is not suitable, for instance because of serialization overhead of large data structures.

4

1 回答 1

0

没有共享内存。根据定义,我们希望每个工作人员(“线程”)都有自己的活动场所。但是,如果您共享本地位置,目前您可以使用 WebSQL,但这并不明智,因为它不是线程安全的。将来我们也许可以使用 indexedDB(何时实现!)

您可能想反过来检查并使用 Shared Workers。这将为您提供从应用程序的多个选项卡/窗口中利用同一工作人员的方法。我不确定它是否适合你的情况...

于 2012-03-11T13:45:52.957 回答