title: Posting to Handler tied to current thread
body: <p>I have a Handler, <code>mHandler</code>, tied to the main thread. <code>mHandler</code> resides in a <code>Service</code>. Say I now post a <code>Runnable</code> to <code>mHandler</code> from the main thread like so:</p>
  
  <pre><code>public class SomeService extends Service {
      // Handler is created on the main thread
      // (and hence it is tied to the main thread)
      private Handler mHandler = new Handler();
  
      @Override
      public void onDestroy() {
          // onDestroy runs on the main thread
          // Is the code in this Runnable processed right away?
          mHandler.post(new Runnable() {
              // (Some code statements that are to be run on the main thread)
              ...
          });
          super.onDestroy();
      }
  }
  </code></pre>
  
  <p>I know the example is a little silly as the <code>Handler</code> is unnecessary. However, it is a good example for this question.</p>
  
  <p>Now my questions are:</p>
  
  <ol>
  <li>Will the code statements in the <code>Runnable</code> be processed right away as the thread that posts the <code>Runnable</code> is also the thread that is to process the <code>Runnable</code>? Or does it work differently as the <code>Handler</code> internally uses a <code>MessageQueue</code> and hence there might be <code>Runnable</code>s posted to the <code>Handler</code> elsewhere (which arrive before my <code>Runnable</code>)?</li>
  <li>Moreover, is it possible that the statements will never run as the <code>post(Runnable r)</code> is an async call and hence <code>onDestroy()</code> will finish and the <code>Service</code> will be killed by the system before the <code>Handler</code> gets to run the code.</li>
  </ol>
  
  <p>Thank you in advance.</p>