iphone NSCondition - App is crashing when "wait" is called
<p>I am working on iphone app.
I created a custom class that derives from "NSCondition".
The following piece of code is working fine with iPhone SDK 3.1.3</p>

<pre><code>- (bool)waitForFinish {
@try {
    [self lock];
    while (!done) {
        [self wait];
    }
}
@finally {
    [self unlock];
}
return success;
}
</code></pre>

<p>The app is crashing on iPhone SDK 4.0 at line "[self wait]"
What might be the reason for crash in iPhone 4.0 SDK?
I noticed that the loop "while(!done)" is running for 4 times and then its crashing.</p>

<p>//Adding more info</p>

<pre><code>-(void)releaseUse {
[self lock];
@try {
    done = 1;
    [self broadcast];
}
@finally {
    [self unlock];
}
[self notifyComplete];
</code></pre>

<p>}</p>

<p>The above function is called when a file is downloaded so that it will send a broadcast message to come out of wait state.</p>

<p>Apple says that in iPhone OS 4, it fixed a bug related to NSCondition. (I don't know what's the bug). I think it might be causing error in iPhone SDK 4 and not in iPhone SDK 3.1</p>
