code: func (latches *Latches) release(lock *Lock, wakeupList []*Lock) []*Lock {
  	wakeupList = wakeupList[:0]
  	for lock.acquiredCount > 0 {
  		if nextLock := latches.releaseSlot(lock); nextLock != nil {
  			wakeupList = append(wakeupList, nextLock)
  		}
  	}
  	return wakeupList
  }
docs: // release releases all latches owned by the `lock` and returns the wakeup list.
  // Preconditions: the caller must ensure the transaction's status is not locked.