I use TThread
in my application, and I have many functions that I would like to use inside it. The functions that I use take time to complete, so it is not ideal for use in threads. That's why I was wondering if there is a way, besides copying and pasting the function / procedure, and then adding (maybe adding) my terminated
flags to the function. I do not want to use the TerminateThread
API!
A brief example:
procedure MyProcedure; begin // some work that takes time over a few lines of code // add/inject terminated flag?! // try... finally... end; procedure TMyThread.Execute; begin MyProcedure; // or copy and paste myprocedure end;
So, is there an efficient way to write procedures / functions that help me with the terminated
flag? In addition, the procedures / functions must be global, so other functions / procedures may also call them.
source share