title: Multithreaded Uploader
body: <p>I want to upload huge files (between 2 to 40 GB) to Azure Blob Storage.</p>
  
  <p>First I successfully split each file to chunks (each chunk = 2 MB).
  Then I upload chunks one by one, after each chunk is uploaded successfully I update a temp file to be able to resume the upload in case the application is closed.</p>
  
  <p>Now I want to make the uploading operation Multithreaded. 
  After reviewing the TPL I got confused where to start!</p>
  
  <p>any guidance where to start with TPL?</p>
  
  <pre><code>void Upload(int segmentId)
  {
      try
      {
          string blockId = GetBlockId(segmentId);
          var segment = GetSegment(FilePath, segmentId, SeqmentSize);
          var md5Hash = CalcMd5Hash(segment);
  
          var blob = new CloudBlockBlob(_link.Uri);
          using (var memoryStream = new MemoryStream(segment))
          {
              blob.PutBlock(blockId, memoryStream, md5Hash);
          }
  
          SerializeStatus();
      }
      catch (Exception exception)
      {
          ...
      }
  }
  </code></pre>