_findTID(id) {
    let tid = this.threads.indexOf(id);
    if (tid === -1) {
      // Try to find a recently released slot in the array:
      tid = this.threads.findIndex(isUndefined);
    }
    return tid === -1 ? this.threads.length : tid;
  }
@param {string | number | undefined} id
@returns {number}
@private

Memory-efficient finder of a free item index in the threads array.