<div dir="ltr">A few years ago I posted in this mailing list about my implementation of creating thread through a simple method. I'm not sure who copied it into the RTL, but I was checking on it today and it's wrong.<div><br></div><div>Wrong in the fact that's its just not usable given the copied design. Here is how it should work.</div><div><br></div><div>procedure TSomeForm.DoWork(Thread: TSimpleThread);</div><div>begin</div><div> while not Thread.Terminated do</div><div> // <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">DoIntensiveWork suppossably returns some text message</span></div><div> Thread.Status := DoIntensiveWork;<br></div><div> Thread.Status := 'Work done!'</div><div>end;<br></div><div><br></div><div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">procedure TSomeForm.DoWorkStatus(Sender: TObject);</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">begin</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"> // Safely do something with the thread status text</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"> StatusMemo.Lines.Add(Status);<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">end;<br></div><br></div><div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">procedure TSomeForm.IntensiveButtonClick(Sender: TObject);</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">begin</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"> // Stop any previous work</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"> if FWork <> nil then</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"> FWork.Terminate;</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"> // Start some work</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"> FWork := TSimpleThread.Create(DoWork, DoWorkStatus);</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">end;<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">procedure TSomeForm.FormDestroy(Sender: TObject);</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">begin</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"> // Clean up</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"> FWork.Free;</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">end;<br></div><br></div><div>So in a nutshell, you can define work to be done on a thread without the need to define a TThread derived class. Status is optional. Freeing is optional.<br></div><div><br></div><div>Here's the problems with the RTL version.</div><div><br></div><div>A) TThread.ExecuteInThread returns a TThread </div><div>B) The actual instance returned by <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">ExecuteInThread is TSimpleStatusProcThread</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">C) User has to know to typecast the return</span></div><div>D) Type <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">TSimpleStatusProcThread has no accessible methods or properties</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">E) Status cannot be set, terminated cannot be checked, and no synchronization is available</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">If anyone cares to fix this, for reference here is my class declaration. Usage is as simple as, <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">FWork := TSimpleThread.Create(DoWork, DoWorkStatus); with DoWorkStatus being optional.</span></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span class="gmail-hljs-comment" style="color:rgb(153,153,136);font-style:italic;font-family:Consolas,monospace;font-size:12.8px;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">{ TThreadExecuteMethod is the method invoked when a TSimpleThread is created }</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
TThreadExecuteMethod = </span><span class="gmail-hljs-function" style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">procedure</span><span class="gmail-hljs-params">(Thread: TSimpleThread)</span> <span class="gmail-hljs-title" style="color:rgb(153,0,0);font-weight:bold">of</span> <span class="gmail-hljs-title" style="color:rgb(153,0,0);font-weight:bold">object</span>;</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
</span><span class="gmail-hljs-comment" style="color:rgb(153,153,136);font-style:italic;font-family:Consolas,monospace;font-size:12.8px;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">{ TSimpleThread allows objects to create a threading method without defining a new thread class
See also
<link Overview.Codebot.System.TSimpleThread, TSimpleThread members> }</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
</span><span class="gmail-hljs-title" style="color:rgb(153,0,0);font-weight:bold;font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">TSimpleThread</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> = </span><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold;font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">class</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">(TThread)
</span><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold;font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">private</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
FExecuteMethod: TThreadExecuteMethod;
FTempStatus: </span><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold;font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">string</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">;
FStatus: </span><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold;font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">string</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">;
FOnStatus: TNotifyEvent;
</span><span class="gmail-hljs-function" style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">procedure</span> <span class="gmail-hljs-title" style="color:rgb(153,0,0);font-weight:bold">DoStatus</span>;</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
</span><span class="gmail-hljs-function" style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">procedure</span> <span class="gmail-hljs-title" style="color:rgb(153,0,0);font-weight:bold">SetStatus</span><span class="gmail-hljs-params">(<span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">const</span> Value: <span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">string</span>)</span>;</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
</span><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold;font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">protected</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
</span><span class="gmail-hljs-comment" style="color:rgb(153,153,136);font-style:italic;font-family:Consolas,monospace;font-size:12.8px;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">{ Sets FreeOnTerminate to True and executes the method }</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
</span><span class="gmail-hljs-function" style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">procedure</span> <span class="gmail-hljs-title" style="color:rgb(153,0,0);font-weight:bold">Execute</span>;</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> </span><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold;font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">override</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">;
</span><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold;font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">public</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
</span><span class="gmail-hljs-comment" style="color:rgb(153,153,136);font-style:italic;font-family:Consolas,monospace;font-size:12.8px;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">{ Create immediately starts ExecuteMethod on a new thread }</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
</span><span class="gmail-hljs-function" style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">constructor</span> <span class="gmail-hljs-title" style="color:rgb(153,0,0);font-weight:bold">Create</span><span class="gmail-hljs-params">(ExecuteMethod: TThreadExecuteMethod;
OnStatus: TNotifyEvent = <span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">nil</span>; OnTerminate: TNotifyEvent = <span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">nil</span>)</span>;</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
</span><span class="gmail-hljs-comment" style="color:rgb(153,153,136);font-style:italic;font-family:Consolas,monospace;font-size:12.8px;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">{ Synchronize can be used by ExecuteMethod to invoke a method
on the main thread }</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
</span><span class="gmail-hljs-function" style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">procedure</span> <span class="gmail-hljs-title" style="color:rgb(153,0,0);font-weight:bold">Synchronize</span><span class="gmail-hljs-params">(Method: TThreadMethod)</span>;</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
</span><span class="gmail-hljs-comment" style="color:rgb(153,153,136);font-style:italic;font-family:Consolas,monospace;font-size:12.8px;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">{ You should only set status inside ExecuteMethod }</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
</span><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold;font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">property</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> Status: </span><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold;font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">string</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> </span><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold;font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">read</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> FStatus </span><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold;font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">write</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> SetStatus;
</span><span class="gmail-hljs-comment" style="color:rgb(153,153,136);font-style:italic;font-family:Consolas,monospace;font-size:12.8px;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">{ Terminated is set to True after the Terminate method is called }</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
</span><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold;font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">property</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> Terminated;
</span><span class="gmail-hljs-keyword" style="color:rgb(51,51,51);font-weight:bold;font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">end</span><span style="color:rgb(51,51,51);font-family:Consolas,monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">;</span><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><div><br></div><br class="gmail-Apple-interchange-newline"><br></div></div>