If your computer gets the spinning pinwheel of death, don't worry, its rare that your whole mac is actually frozen. Follow these steps to resolve the issue:
1. Find another working application, bring it to the front, and click on the desktop. This should bring the computer back under your control. The frozen application is likely trying to think and is going in a loop.
2. If you've given the frozen application a few minutes to unfreeze and it is still frozen, force quit the application by right-clicking the application's icon in the app bar and clicking force quit.