MathWorks Interview Question

This simple program is not thread-safe. Make it thread-safe.