[fpc-pascal] RTL Thread.ExecuteInThread interface and implementation wrong
    Anthony Walter 
    sysrpl at gmail.com
       
    Wed Mar 21 01:52:34 CET 2018
    
    
  
Okay, but the problem with the current implementation in Classes.pas is
that Status cannot be used, Terminated cannot be checked, and there is no
access to Synchronize. As such OnStatus is pointless, and the semantics of
checking Terminated doesn't work. If that's how the these
ExecuteInThread class methods on TThread are going work then they should be
removed because they don't have significant function and likely would
confuse users.
Eg. of confusion when trying to use ExecuteInThread Q: How does OnStatus
work? A: It doesn't. Q: How can I check if my thread method is terminated?
A: Forget about Thread.Terminated, you'll need to set a flag somewhere or
create you own solution. Q: How can I suspend my method and safely join the
main thread, because I normally use Synchronize? A: You'll have to do
without Synchronize or maybe figure out a workaround.
So IMO ExecuteInThread should either be removed or these problems should be
fixed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180320/c0fa621b/attachment.html>
    
    
More information about the fpc-pascal
mailing list