On Dec 9, 2019, at 10:16 AM, Peter Levart <peter.lev...@gmail.com> wrote: > What do you think? Might this be better performance wise?
Yes, a fast positive proof that the access is allowed can be implemented along the lines you mention. The owner token could be overloaded in additional ways, if and when we do more patterns of sharing. The case of a permanently shareable heap-allocated segment could be handled by a similar fast check, if some constant sentinel value ALL_THREADS is stored in the owner instead Thread.current(). The case of a temporarily shareable segment, held jointly by several threads, could be handled by an owner token which was suitably tied to those threads. This suggests that “owner == currentThread()” could be at some point generalized to “owner.accepts(currentThread())” assuming that the fast paths of OwnerSet::accepts could be optimized well. — John