My app creates secondary thread by NSOperationQueue. In main thread, it writes message in buffer which is global variable. In secondary thread, it wait until message with new line character arrives. It works well without optimization option. It stays in while loop if I compile with any optimization option(-O1 ~ -Os). But if I write NSLog inside loop, it works. What is problem of this? Is there better way I can solve this problem without using NSLog?My app creates secondary thread by NSOperationQ