code: func (tp *DocumentsWriterPerThreadPool) lockAny() (res *ThreadState) {
  	for res == nil {
  		if res = tp.findNextAvailableThreadState(); res == nil {
  			// ThreadState is already locked before return by this method:
  			if res = tp.newThreadState(); res == nil {
  				// Wait until a thread state freez up:
  				func() {
  					tp.hasMoreStates.L.Lock()
  					defer tp.hasMoreStates.L.Unlock()
  
  					tp.hasMoreStates.Wait()
  				}()
  			}
  		}
  	}
  	return
  }
docs: /*
  It's unfortunately that Go doesn't support 'Thread Affinity'. Default
  strategy is LIFO.
  */