Volatile is needed here in the presence of optimization. Otherwise the read of ready can be legally moved out of the while loop.
Assuming limitations to optimization that are not promised by the standard may be fine now, but cause great grief to future maintainers as compilers improve.