[Lazarus] (no subject)

José Mejuto joshyfun at gmail.com
Wed Sep 22 16:27:17 CEST 2010


Hello Lazarus-List,

Wednesday, September 22, 2010, 12:12:31 AM, you wrote:

V> nice! sometimes the solution is simpler than you think :)

V> patient - if i do this it hurts,
V> doctor - don't do it then

V> you could consider
V> - check for locked resources after suspending the thread, resuming locking
V> thread of necessary
V> - a 'server' thread that other threads send messages to, a bit like a
V> database server but for your imaginary app.
V> - theres probably plenty of ideas to resolve/work around this if you search
V> web

Direct use of suspend/resume in i386 at least is a call for serious
and very, very difficult to track problems. A simple code like:

if A=0 then Thread.Suspend;
DoSomething();
if Thread.Suspended then Thread.Resume;

Is not garanteed to end in a thread with a resume state. I had
experienced (unfortunatly) this problems in the past, and finally
changed to events, but it can also be changed to other functions to
not call suspend/resume directly and ensure the thread transition from
state to state is completed.

-- 
Best regards,
 José





More information about the Lazarus mailing list