Re: [DISCUSS][Java] Reduce the range of synchronized block when releasing an ArrowBuf

2019-09-30 Thread Antoine Pitrou
I will just point out that using an atomic counter or boolean /outside/ of a locked section is a common pattern in C++. The benefit comes up if the locked section is conditional and the condition is rarely true. Regards Antoine. Le 30/09/2019 à 06:24, Jacques Nadeau a écrit : > For others th

Re: [DISCUSS][Java] Reduce the range of synchronized block when releasing an ArrowBuf

2019-09-29 Thread Jacques Nadeau
For others that don't realize, the discussion of this is happening on the pull request here: https://github.com/apache/arrow/pull/5526 On Fri, Sep 27, 2019 at 4:52 AM Fan Liya wrote: > Dear all, > > When releasing an ArrowBuf, we will run the following piece of code: > > private int decrement(i

[DISCUSS][Java] Reduce the range of synchronized block when releasing an ArrowBuf

2019-09-27 Thread Fan Liya
Dear all, When releasing an ArrowBuf, we will run the following piece of code: private int decrement(int decrement) { allocator.assertOpen(); final int outcome; synchronized (allocationManager) { outcome = bufRefCnt.addAndGet(-decrement); if (outcome == 0) { lDestructionTi