code: function () {
              if (opt.globalTask.state === 'cancel') return;
              for (; that._uploadingThreadCount < that.uploadMaxThread && task.currentIndex < task.chunkCount; task.currentIndex++) {
                  var chunk = task.chunks[task.currentIndex];
                  if (chunk.state !== 'waiting') continue;
                  (function (chunk) {
                      chunk.state = 'uploading';
                      task.uploadingCount++;
                      that._uploadingThreadCount++;
                      uploadSingleChunk.call(that, task, chunk, function (error, data) {
                          task.uploadingCount--;
                          that._uploadingThreadCount--;
                          if (error) { // 错误马上结束
                              chunk.state = 'error';
                              uploadError(error, data);
                          } else {
                              chunk.state = 'success';
                              if (task.uploadingCount <= 0 && task.currentIndex >= task.chunkCount) { // 全部完成
                                  uploadSuccess();
                              } else { // 未完成，处理执行下一个分片
                                  uploadNextChunk();
                              }
                          }
                      });
                  })(chunk);
              }
              if (task.uploadingCount === 0 && task.currentIndex === task.chunks.length) { // 全部不需要上传
                  uploadSuccess();
              }
          }
docs: 开始上传并发上传，同一个上传实例里共用线程数限制