There's a mistake here at least:
Thread.Execute
(
freeonterminate:=true
process();
MyThread.Terminate;
MyThread.WaitFor;
)
You can't call WaitFor from inside Execute, the whole functions purpose is to wait until Execute ends, therefore it's infinite loop. Remove both these lines and it should be fine for that part
MyThread.Terminate;
MyThread.WaitFor;
(referring to self object using reference variable (MyThread) is also unnecessary and potentially dangerous)