title: Getting a Delphi TTimer to work with a multi-threading app
body: <p>I have an issue with a simple TTimer that's <strong>initiated and have its OnTimer event executed in the main app thread</strong>, the code looks like this:</p>
  
  <pre><code>procedure TForm1.DoSomeStuff();
  begin
       OmniLock.Acquire;
       try
          Parallel.Pipeline.NumTasks(MaxThreads).Stage(StageProc).Run;
  
          if (MyTimer = nil) then
          begin
               MyTimer := TTimer.Create(nil);
               MyTimer.Interval := 60 * 1000;  // timer fired every 60 seconds
               MyTimer.OnTimer := MyTimerEvent;
               MyTimer.Enabled := True;
           end;
        finally
               OmniLock.Release;
        end;    // try/finally
   end;
  </code></pre>
  
  <p>Everthing work just fine when I execute the code in a simple project/demo, but in my app (which uses Omni Thread Library v3), the timer event is <strong>never fired</strong></p>
  
  <p>I'm pretty sure <strong>it's nothing</strong>, I just can't figure out what's wrong!</p>
  
  <p>I triple checked: <code>MyTimer</code> is only assigned once in my code, its OnTimer event is correctly assigned, etc...</p>
  
  <p>I'm using Delphi 2010</p>
  
  <p>Anyone knows how to fix this?</p>