create variable somewhere that is global to both the thread and the procedure of where the code is taking place and inside the code block you test it.
In global space somewhere
var
Busy :TCriticalSection;
-- in the Form Create Section---
Busy := TCriticalSection.Create;
--- in the code block where this needs the be checked --
Busy.Enter;
if its not busy then it will continue in your code, if it is busy then it will not return from that call until its not busy
when done executing the sensitive code do this before you exit the body.,.
Busy.Leave;
that will clear the lock
so you may need to do this with the timer code and the Sync call code from the thread so the two do not collide