Main Thread
Close reąuest receivedby main thread
Main thread sets terminated
property of calculation thread.
M ain thre ad waits for calculation thread to terminate
Pritne calculation thread.
Thread reads terminate dproperty as false, anduses synchronize to transfer result. Synchronize waits for main thread to become idle.