Autor Beitrag
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Mi 13.05.09 15:42 
Hi. Ich habe mal probiert aus dem Thread heraus eine Prozedur des Hauptthreads aufzurufen. So nun hab ich mir mal vom debugger das Threadfenster angesehen und stelle fest das die procedure im Thread und nicht im Hauptthread ausgeführt wird. ??? Anzeige fehler oder wirklich so? Bzw. kann ich etwas dagegen machen?

Für hilfe bin ich sehr dankbar =)
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Do 14.05.09 16:30 
Wenn du eine Prozedur schreibst, dann ist diese nicht an einen Thread gebunden sondern läuft immer dort, von wo sie aufgerufen wird. Wenn du eine Prozedur von einem Thread aus im Hauptthread aufrufen willst, verwende Synchronize und übergebe die (parameterlose) Prozedur. Sobald der Hauptthread "Zeit" hat, wird dann diese Prozedur dort ausgeführt. Der Thread wartet solange, bis die Prozedur im Hauptthread fertig ausgeführt wurde. Willst du nicht, dass gewartet wird, verwende Queue, statt Synchronize.
thepaine91 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Do 14.05.09 18:27 
Danke für deine Antwort.
:autsch: Synchronize natürlich... das hab ich komplett vergessen.
Super dann hab ich endlich was ich wollte. :P
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Sa 16.05.09 12:20 
user profile icondelfiphan hat folgendes geschrieben Zum zitierten Posting springen:
Willst du nicht, dass gewartet wird, verwende Queue, statt Synchronize.

Beispiel bitte :-)

_________________
In the beginning was the word.
And the word was content-type: text/plain.
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: So 17.05.09 14:51 
Nimm ein Beispiel für Synchronize und ersetze es durch Queue... (da Queue asynchron ist, kann es sein, dass das nicht durchaus einfach so geht. Vom Konzept her ist Synchronize wie SendMessage und Queue wie PostMessage...)
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mo 18.05.09 22:37 
Man lernt doch nie aus. Fein. Danke :-)

_________________
In the beginning was the word.
And the word was content-type: text/plain.