Re: [fpc-pascal] Correct way for using TThread.ForceQueue?

2022-04-25 Thread Sven Barth via fpc-pascal
Am 25.04.2022 um 17:30 schrieb Michael Van Canneyt via fpc-pascal: On Mon, 25 Apr 2022, Thomas Kurz via fpc-pascal wrote: I cannot remember why, but a long time ago when learning Delphi 5 or 6, I have learned not to call the destructor from within any method of the class, only from outside. 

Re: [fpc-pascal] Correct way for using TThread.ForceQueue?

2022-04-25 Thread Michael Van Canneyt via fpc-pascal
On Mon, 25 Apr 2022, Thomas Kurz via fpc-pascal wrote: I cannot remember why, but a long time ago when learning Delphi 5 or 6, I have learned not to call the destructor from within any method of the class, only from outside. If this is no longer true nowadays (or maybe, has never been true

Re: [fpc-pascal] Correct way for using TThread.ForceQueue?

2022-04-25 Thread Thomas Kurz via fpc-pascal
EDIT: The code should be "TThread.ForceQueue", not "TThread.Synchronize"; I have corrected that. I cannot remember why, but a long time ago when learning Delphi 5 or 6, I have learned not to call the destructor from within any method of the class, only from outside. If this is no longer true

Re: [fpc-pascal] Correct way for using TThread.ForceQueue?

2022-04-25 Thread Thomas Kurz via fpc-pascal
I cannot remember why, but a long time ago when learning Delphi 5 or 6, I have learned not to call the destructor from within any method of the class, only from outside. If this is no longer true nowadays (or maybe, has never been true before), I'd like to use this solution. Just to be sure

Re: [fpc-pascal] Correct way for using TThread.ForceQueue?

2022-04-25 Thread Michael Van Canneyt via fpc-pascal
On Mon, 25 Apr 2022, Thomas Kurz via fpc-pascal wrote: This is a very elegant solution but it can only be used for Synchronize, right? Because with ForceQueue I cannot know when it's done and freeing within Run (i.e. "Self.Free") would fail. Why would this fail according to you ? I have

Re: [fpc-pascal] Correct way for using TThread.ForceQueue?

2022-04-25 Thread Thomas Kurz via fpc-pascal
This is a very elegant solution but it can only be used for Synchronize, right? Because with ForceQueue I cannot know when it's done and freeing within Run (i.e. "Self.Free") would fail. Using an advanced record would be fine, but it doesn't fit the declaration "TThreadMethod = procedure of

Re: [fpc-pascal] Correct way for using TThread.ForceQueue?

2022-04-25 Thread Mattias Gaertner via fpc-pascal
On Mon, 25 Apr 2022 15:47:57 +0200 Thomas Kurz via fpc-pascal wrote: >[...] > As far as I have seen so far, the common solution is to use a > variable inside the class to cache the parameters, then to use a > DoCallSync procedure which takes no parameters but can use the cached > values inside,