How to block a thread efficiently until a particular condition is met : <p>I am working on a multi-threaded server application in Linux using pthread library.For each client being connected there are two threads as I make two connection from device and one thread has dependency on other.until a particular condition is met First thread loop continuously in a while loop.when the condition is met the second thread sets the flag and the first thread based on that breaks the while loop and perform the required tasks.</p>

<p>Is running a While loop continuously in a Thread until a particular condition is met a good approach.If not please specify a better approach.</p>
