Main Thread
Close reąuest receivedby main thread
Mainthread sets terminated property of calculation thread.
M ain thre ad waits for calculation thread to teiminate
WaitFor operation completes. Main thread cle ans up after calculation thread and exits.
Pritne calculation thread.
Thread reads terminate d prop erty, and exits as soon as possible.