skiplist/access_barrier.go
func (ab *AccessBarrier) Release(bs *BarrierSession) {
	if ab.active {
		liveCount := atomic.AddInt32(bs.liveCount, -1)
		if liveCount == barrierFlushOffset {
			buf := ab.freeq.MakeBuf()
			defer ab.freeq.FreeBuf(buf)

			// Accessors which entered a closed barrier session steps down automatically
			// But, they may try to close an already closed session.
			if atomic.AddInt32(&bs.closed, 1) == 1 {
				ab.freeq.Insert(unsafe.Pointer(bs), CompareBS, buf, &ab.freeq.Stats)
				if atomic.CompareAndSwapInt32(&ab.isDestructorRunning, 0, 1) {
					ab.doCleanup()
					atomic.CompareAndSwapInt32(&ab.isDestructorRunning, 1, 0)
				}
			}
		}
	}
}
func (ab *AccessBarrier) Release(bs *BarrierSession) {
	if ab.active {
		liveCount := atomic.AddInt32(bs.liveCount, -1)
		if liveCount == barrierFlushOffset {
			buf := ab.freeq.MakeBuf()
			defer ab.freeq.FreeBuf(buf)

			// Accessors which entered a closed barrier session steps down automatically
			// But, they may try to close an already closed session.
			if atomic.AddInt32(&bs.closed, 1) == 1 {
				ab.freeq.Insert(unsafe.Pointer(bs), CompareBS, buf, &ab.freeq.Stats)
				if atomic.CompareAndSwapInt32(&ab.isDestructorRunning, 0, 1) {
					ab.doCleanup()
					atomic.CompareAndSwapInt32(&ab.isDestructorRunning, 1, 0)
				}
			}
		}
	}
}
// Release marks leaving of an accessor in the skiplist