Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-07

More thread questions.

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Frank Church

Can I take it that a thread will never execute until the Execute procedure is called, and if the Execute procedure is exited, it will not run again until called by the main thread?

i.e Resuming a thread which has exited will achieve nothing unless it is called within the scope of an existing Execute?

Frank Church ======================= http://devblog.brahmancreations.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100712/6dd41e7b/attachment.html>

Reply by email

Andrew Brunner
to Frank Church

You can't call execute. The thread will execute and exit.

If the thread is created as suspended, it will not be called until right after resume. If you need to you can run a loop inside execute, but when execute completes the thread is either freed or it is waiting to be freed (see FreeOnTerminate)

Resuming a thread that is complete will accomplish nothing. Resuming a suspended thread will do just that.

2010/7/12 Frank Church :

Show quoted text 21 lines
Can I take it that a thread will never execute until the Execute procedure is called, and if the Execute procedure is exited, it will not run again until called by the main thread? i.e Resuming a thread which has exited will achieve nothing unless it is called within the scope of an existing Execute? -- Frank Church ======================= http://devblog.brahmancreations.com -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Paul Nicholls
to Frank Church: Can I take it that a thread will never execute until the Execute procedure is called, and…

Hi Frank,
AFAIK, a thread WILL execute immediately exiting the Create method unless you pass False to the suspended variable in the create method, and call Resume in the main thread later on.

I don't think resuming a thread will never do anything if the threads execute method has fallen through, but people can feel free to correct me on this :)

cheers,
Paul

Earlier message 24 lines
----- Original Message ----- From: Frank Church To: Lazarus mailing list Sent: Tuesday, July 13, 2010 1:42 AM Subject: [Lazarus] More thread questions. Can I take it that a thread will never execute until the Execute procedure is called, and if the Execute procedure is exited, it will not run again until called by the main thread? i.e Resuming a thread which has exited will achieve nothing unless it is called within the scope of an existing Execute? -- Frank Church ======================= http://devblog.brahmancreations.com ------------------------------------------------------------------------------ --

Reply by email