AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

Allgemeine Frage zu synchroize() in Threads

Ein Thema von Flogo · begonnen am 13. Jan 2004 · letzter Beitrag vom 14. Jan 2004
 
Benutzerbild von Flogo
Flogo

Registriert seit: 24. Mär 2003
Ort: Freiburg im Breisgau
317 Beiträge
 
Delphi 7 Professional
 
#1

Allgemeine Frage zu synchroize() in Threads

  Alt 13. Jan 2004, 19:46
Ich hab folgendes versucht:
Delphi-Quellcode:
procedure Thread.Execute;
begin
  { Place thread code here }
  repeat
    Application.ProcessMessages;
  until terminated;
end;

function Thread.WalkTo(APoint: TPoint): Boolean;
begin
  WalkToPoint := APoint;
  synchronize(Ziel);
  result := false;
  repeat
    if (Form1.An.Ziel.X <> APoint.X) or (Form1.An.Ziel.Y <> APoint.Y) then exit;
    Application.ProcessMessages;
  until (Form1.An.Left = APoint.X) and (Form1.An.Top = APoint.Y);
  result := true;
end;

procedure Level.Ziel;
begin
  Form1.Ziel(WalkToPoint); // Setzt Form1.An.Ziel auf WalkToPoint
end;
Bei dem Synchronize bleibt er aber immer hängen. (Die Proc Ziel wird nie ausgeführt). Was mache ich falsch? muss die synchronize Methode irgendwelche Vorraussetzungen erfüllen? (z.B. mit genau dem gleichen Namen im HauptThread deklariert sein)
Komischerweise wird das Ziel richtig gesetzt wenn man statt synchronize(ziel);   Form1.Ziel(WalkToPoint); direkt anspricht. Also wozu braucht man das Synchronize überhaupt?
If one coincidence can occur, then another coincidence can occur. And if one coincidence happens to occur just after another coincidence, then that is just a coincidence.
DNA

www.Anyxist.de
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:26 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz