I need a thread to wait utnil this bool is set to true. This works fine in debug but when i compile it in release it pretty much dies. What is the proper way to do this?

Code:
			while(m_rightClickFinished == false)
			{
				//wait until right click stuff happens in other thread
			}
			m_rightClickFinished = false;
			return true;