func (ab *AccessBarrier) FlushSession(ref unsafe.Pointer) {
	if ab.active {
		ab.Lock()
		defer ab.Unlock()

		bsPtr := atomic.LoadPointer(&ab.session)
		newBsPtr := unsafe.Pointer(newBarrierSession())
		atomic.CompareAndSwapPointer(&ab.session, bsPtr, newBsPtr)
		bs := (*BarrierSession)(bsPtr)
		bs.objectRef = ref
		ab.activeSeqno++
		bs.seqno = ab.activeSeqno

		atomic.AddInt32(bs.liveCount, barrierFlushOffset+1)
		ab.Release(bs)
	}
}
func (ab *AccessBarrier) FlushSession(ref unsafe.Pointer) {
	if ab.active {
		ab.Lock()
		defer ab.Unlock()

		bsPtr := atomic.LoadPointer(&ab.session)
		newBsPtr := unsafe.Pointer(newBarrierSession())
		atomic.CompareAndSwapPointer(&ab.session, bsPtr, newBsPtr)
		bs := (*BarrierSession)(bsPtr)
		bs.objectRef = ref
		ab.activeSeqno++
		bs.seqno = ab.activeSeqno

		atomic.AddInt32(bs.liveCount, barrierFlushOffset+1)
		ab.Release(bs)
	}
}
// FlushSession closes the current barrier session and starts the new session.
// The caller should provide the destructor pointer for the new session.