Hi Peter, On 27/09/18 11:28, Peter Levart wrote:
> May I just note that multithreaded bulk operations are kind of possible > without external synchronization (i.e. locks) if you follow a simple > protocol: > > - never use relative operations on the shared ByteBuffer instance > - never use operations that change internal > mark/position/limit/byteOrder on the shared ByteBuffer instance > - a concurrent bulk operation on 'bb' consists of: > > ByteBuffer myBb = bb.slice(0, bb.capacity()); > // use myBb to perform concurrent bulk operation (any operations are > allowed) and then throw it away or cache it in ThreadLocal > > If you combine this with explicit fences and/or atomic 16, 32 and 64 bit > operations via VarHandles. (see > MethodHandles.byteBufferViewVarHandle(Class, ByteOrder)), concurrent > programming with ByteBuffer(s) is entirely possible. Thank you for the usual expert advice. I am sure it will be of great help in implementing a persistent data management library over this JEP's base capability. regards, Andrew Dinn ----------- Senior Principal Software Engineer Red Hat UK Ltd Registered in England and Wales under Company Registration No. 03798903 Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander