What an exciting time!

On Fri, Jan 27, 2017 at 7:36 AM, Brian Hackett <bhackett1...@gmail.com>
wrote:

>
> To help avoid threading bugs during and after this transition,
> ​​
> bug
> 1325050 also adds a ProtectedData class, which is a template that can
> be used on class fields to specify the conditions under which the
> field may be accessed.  This condition will be checked in debug
> builds.  Bug 1325050 uses ProtectedData for all the contents of
> JSContext, JSRuntime, Zone, and ZoneGroup (and classes embedded within
> these), and it would be nice if people could continue to use this for
> new members in these classes going forward.  (Eventually there might
> be an analysis to check that ProtectedData is used on all members of
> these classes.)
>

​Have you taken a look at the js::ExclusiveData[0] template class?​ It is a
lock that contains the protected data, so that the only way to access the
protected data is by derefencing a magic pointer / lock guard RAII type
that acquires the lock on construction and releases it again upon
destruction.

ProtectedData seems very similar, and it would be nice to have some
exposition in the docs on why both exist (or maybe we don't need both?) and
when one should choose ExclusiveData versus the new ProtectedData.

Thanks, Brian!

[0]
http://searchfox.org/mozilla-central/rev/8fa84ca6444e2e01fb405e078f6d2c8da0e55723/js/src/threading/ExclusiveData.h#18-79
_______________________________________________
dev-tech-js-engine-internals mailing list
dev-tech-js-engine-internals@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to