Patch by Matt McCutchen to fix active waiting in main loop. (Bug 480)