title: condition sample in "iOS threading programming guide"
body: <p>When reading "iOS threading programming guide", I got confused with the sample code in section "Using Conditions".</p>
  
  <p>Look at <strong>Listing 4-3</strong> and <strong>Listing 4-4</strong> which are used to demonstrate the use of NSCondition class. If a thread starts waiting for the condition using 4-3, and then the second thread tries to signal the condition using 4-4. Since the condition is being locked by the first thread, is there a chance for the second thread signal the condition? If no, isn't it like a deadlock?</p>
  
  <p>Forgive me if this is a silly question :-)</p>
  
  <p>Here's the sample Apple provided on how to use Cocoa condition:</p>
  
  <p><strong>Listing 4-3</strong> Using a Cocoa condition </p>
  
  <pre><code>[cocoaCondition lock];
  while (timeToDoWork &lt;= 0)
      [cocoaCondition wait];
  timeToDoWork--;
  // Do real work here.
  
  [cocoaCondition unlock];
  </code></pre>
  
  <p><strong>Listing 4-4</strong> Signaling a Cocoa condition</p>
  
  <pre><code>[cocoaCondition lock];
  timeToDoWork++;
  [cocoaCondition signal];
  [cocoaCondition unlock];
  </code></pre>