title: how to make a multithread copy files
body: <p>I want to copy many files in one, but using multiThread,supposing that file A is the file in which different threads copy datas, in this case each thread is meant to copy one file in file A, using this procedure:</p>
  
  <pre><code>procedure ConcatenateFiles(const InFileNames: array of string;
  const OutFileName: string);
  var
  i: Integer;
  InStream, OutStream: TFileStream;
  begin
  OutStream := TFileStream.Create(OutFileName, fmCreate);
  try
   for i := 0 to high(InFileNames) do
   begin
    InStream := TFileStream.Create(InFileNames[i], fmOpenRead);
    try
      OutStream.CopyFrom(InStream, InStream.Size);
    finally
      InStream.Free;
    end;
   end;
  finally
   OutStream.Free;
  end;
  </code></pre>
  
  <p>end;</p>
  
  <p>First, is it possible to realise multithread copy files in this case, because OutFileName is a global variable, two threads can't use it at the same time, and this is the error that i get, 
  if this is possible how can I synchronise threads to avoid the use of OutFileName by more than one processus in a moment?
  And is it really efficient to make a multithread copy files, I'm talking about the speed of copying files.
  thanks for your replies</p>