[Lazarus] (no subject)

José Mejuto joshyfun at gmail.com
Wed Sep 22 20:35:04 CEST 2010


Hello Andrew,

Wednesday, September 22, 2010, 4:50:38 PM, you wrote:

AB> One other thing to think about is something I do often which is to
AB> have a "suspend needed" boolean variable for threads.  So if a suspend
AB> is needed it will be processed at an appropriate section of code where
AB> the thread itself knows whether or not it is indeed safe.  Other wise
AB> it will remain pending for that thread until such time as it can reach
AB> a suspended state, trip another flag, and suspend.

I'm not sure now that my memory is not corrupt :) but I think that a
code like:

Thread.Suspend;
Thread.Resume;

Called from different threads could put the thread in a dumb state
where it is suspended but it can not be resumed due something like a
resume arriving after the suspend has been started, but not finished,
so I think it is only "safe" using critical sections.

-- 
Best regards,
 José





More information about the Lazarus mailing list