title: Slow operations in the Model-View-Presenter pattern
body: <p>How do you handle slow operations in the Model-View-Presenter (or MVC or M-V-VM or whatever variant you are using)?</p>
  
  <p>When you have a slow operation in WinForms or SWT/JFace or whatever desktop framework you are using, you have to run it on a background thread to avoid completely locking up the application. Where do you handle this?</p>
  
  <p>I can see a couple of solutions, but I am not entirely happy with any of them:</p>
  
  <ol>
  <li><p>Have the view call always call the presenter on a background thread. That means that the view have to handle that all invocations from the presenter probably will come from a background thread.</p></li>
  <li><p>Have the view call the presenter on the main thread. The presenter will then have to call back into the view when performing a slow operation, so that it can be run in the background.</p></li>
  </ol>
  
  <p>What do you usually do?</p>
  
  <p><strong>EDIT:</strong> I just saw this article: <a href="http://www.codeproject.com/KB/threads/ThreadedExecuter.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/threads/ThreadedExecuter.aspx</a> . It is basically an implementation of 2. Have anyone tried anything like this?</p>