How can I wait until something has done? lazarus / 13-General ---------------------------------------------------------------------- Tommi · 2006-12-07 10:43 I've two timer events: Timer1, Timer2. The code is like this: function TForm1.Timer1(...); begin [do something] end; function TForm1.Timer2(...); begin [wait until timer1 has finished so:] [do something] end; I thinked to solve the issue writing: Executing:boolean; function TForm1.Timer1(...); begin Executing:=True; [do something] Executing:=false; end; function TForm1.Timer2(...); label 1; begin 1: while Executing do goto 1; [do something] end; But I don't like this soluction bacause it requires a lot of cpu clock to do nothing. How can I solve the issue? Thank You. Bye ---------------------------------------------------------------------- Vincent Snijders · 2006-12-07 11:01 Maybe you simplified your code too much. Therefore I don't see the real problem. Maybe this works for you. Code: [Select] function TForm1.Timer1(...); begin [do something] Timer2(...); end; function TForm1.Timer2(...); begin [do something] end; Alternatively, maybe does this better suit your needs: Code: [Select] function TForm1.Timer1(...); begin   Timer2.Enabled := false; [do something]   Timer2.Enabled := true; end; function TForm1.Timer2(...); begin [do something] end; BTW: the busy while loop doesn't need a label. This works too. Code: [Select]while Executing do; ---------------------------------------------------------------------- RudieD · 2006-12-07 13:45 or Code: [Select]while Executing do sleep(500); ---------------------------------------------------------------------- theo · 2006-12-07 14:18 @Tommi: This looks strange to me. What do you actually want to achieve? Have you thought about doing it in a separate thread?