Re: [Lazarus] A few questions on threads

2011-10-05 Thread Lukasz Sokol
On 04/10/2011 15:02, Frank Church wrote: Do the Start and Resume methods automatically call the Execute method? Clases.inc: line 115 tthread.inc: 98 func.inc: 143 this is WinAPI call thread.inc: 143 threadh.inc: 31 :) Lukasz -- ___

[Lazarus] A few questions on threads

2011-10-04 Thread Frank Church
What is the purpose of the while not Terminated in a threads execute loop? If a thread is doing its own thing and knows when or not it has finished what is the purpose of the while not Terminated Is Terminated designed to be called by other procedures besides the thread itself? Can a thread be

Re: [Lazarus] A few questions on threads

2011-10-04 Thread michael . vancanneyt
On Tue, 4 Oct 2011, Frank Church wrote: What is the purpose of the while not Terminated in a threads execute loop? If a thread is doing its own thing and knows when or not it has finished what is the purpose of the while not Terminated Is Terminated designed to be called by other procedures

Re: [Lazarus] A few questions on threads

2011-10-04 Thread Andreas Berger
On 4/10/2011 06:37, Frank Church wrote: What is the purpose of the while not Terminated in a threads execute loop? If a thread is doing its own thing and knows when or not it has finished what is the purpose of the while not Terminated Your thread is busy chewing up processor time and

Re: [Lazarus] A few questions on threads

2011-10-04 Thread Michael Schnell
On 10/04/2011 11:37 AM, Frank Church wrote: What is the purpose of the while not Terminated in a threads execute loop? If a thread is doing its own thing and knows when or not it has finished what is the purpose of the while not Terminated In Lazarus (and Delphi), Worker Threads can't have an

Re: [Lazarus] A few questions on threads

2011-10-04 Thread Frank Church
On 4 October 2011 10:43, michael.vancann...@wisa.be wrote: On Tue, 4 Oct 2011, Frank Church wrote: What is the purpose of the while not Terminated in a threads execute loop? If a thread is doing its own thing and knows when or not it has finished what is the purpose of the while not

Re: [Lazarus] A few questions on threads

2011-10-04 Thread Frank Church
On 4 October 2011 11:14, Michael Schnell mschn...@lumino.de wrote: On 10/04/2011 11:37 AM, Frank Church wrote: What is the purpose of the while not Terminated in a threads execute loop? If a thread is doing its own thing and knows when or not it has finished what is the purpose of the while

Re: [Lazarus] A few questions on threads

2011-10-04 Thread Michael Schnell
On 10/04/2011 12:26 PM, Frank Church wrote: Isn't it possible to have add new fields to your thread that can be interrogated? Of course you can add any variables and properties to your TMyThread Object. (This is just data-handling and completely independent of the Thread context the code is

Re: [Lazarus] A few questions on threads

2011-10-04 Thread Michael Schnell
On 10/04/2011 12:53 PM, Frank Church wrote: I am looking at Application.QueueAsyncCall and the only parameter it takes in addition to the method pointer is a PrtInt. That seems to limit the options passed compared with TThread.Synchronize. Can the PtrInt be cast to a pointer to a richer data

Re: [Lazarus] A few questions on threads

2011-10-04 Thread Lukasz Sokol
On 04/10/2011 10:43, michael.vancann...@wisa.be wrote: Suspend and Resume have been deprecated, and I want to know how a thread can be suspended. There is - to my knowledge - no safe way of doing so. The thread could start spinning/sleeping on a /safe/ place in its code ? But that'll

Re: [Lazarus] A few questions on threads

2011-10-04 Thread Mark Morgan Lloyd
michael.vancann...@wisa.be wrote: Suspend and Resume have been deprecated, and I want to know how a thread can be suspended. There is - to my knowledge - no safe way of doing so. Can a thread safely suspend itself, subject to an external resume? If not, what is the official alternative?

Re: [Lazarus] A few questions on threads

2011-10-04 Thread michael . vancanneyt
On Tue, 4 Oct 2011, Mark Morgan Lloyd wrote: michael.vancann...@wisa.be wrote: Suspend and Resume have been deprecated, and I want to know how a thread can be suspended. There is - to my knowledge - no safe way of doing so. Can a thread safely suspend itself, subject to an external

Re: [Lazarus] A few questions on threads

2011-10-04 Thread michael . vancanneyt
On Tue, 4 Oct 2011, Lukasz Sokol wrote: On 04/10/2011 10:43, michael.vancann...@wisa.be wrote: Suspend and Resume have been deprecated, and I want to know how a thread can be suspended. There is - to my knowledge - no safe way of doing so. The thread could start spinning/sleeping on

Re: [Lazarus] A few questions on threads

2011-10-04 Thread Michael Schnell
On 10/04/2011 01:54 PM, Mark Morgan Lloyd wrote: Can a thread safely suspend itself, subject to an external resume? If not, what is the official alternative? A semaphore. -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org

Re: [Lazarus] A few questions on threads

2011-10-04 Thread Mark Morgan Lloyd
michael.vancann...@wisa.be wrote: On Tue, 4 Oct 2011, Mark Morgan Lloyd wrote: michael.vancann...@wisa.be wrote: Suspend and Resume have been deprecated, and I want to know how a thread can be suspended. There is - to my knowledge - no safe way of doing so. Can a thread safely suspend

Re: [Lazarus] A few questions on threads

2011-10-04 Thread Lukasz Sokol
On 04/10/2011 14:24, Mark Morgan Lloyd wrote: michael.vancann...@wisa.be wrote: On Tue, 4 Oct 2011, Mark Morgan Lloyd wrote: michael.vancann...@wisa.be wrote: Suspend and Resume have been deprecated, and I want to know how a thread can be suspended. There is - to my knowledge - no safe

Re: [Lazarus] A few questions on threads

2011-10-04 Thread Luca Olivetti
Al 04/10/2011 15:24, En/na Mark Morgan Lloyd ha escrit: Thanks for that Michael. I've got a thread which runs for a stretch in the background to query a database (to avoid a UI glitch), then suspends itself until it's kicked back into life by the main thread approx 30 seconds later. Appears

Re: [Lazarus] A few questions on threads

2011-10-04 Thread Frank Church
On 4 October 2011 10:37, Frank Church vfcli...@gmail.com wrote: What is the purpose of the while not Terminated in a threads execute loop? If a thread is doing its own thing and knows when or not it has finished what is the purpose of the while not Terminated Is Terminated designed to be