Home
Top.Mail.Ru Yandeks.Metrika
Forum: "Main";
Current archive: 2002.04.01;
Download: [xml.tar.bz2];

Down

TThread Find similar branches


lipskiy   (2002-03-20 20:32) [0]

Why is it impossible to specify a procedure with parameters with the Synchronize parameter? This is very inconvenient - you need to work through global variables. Why? Is it still possible to make a call with parameters?



Юрий Зотов   (2002-03-20 20:44) [1]

Because it’s done so. And global variables are completely optional. In a help there is an example.

procedure TMyThread.MyMethod;
begin
AnyMetod (AnyParamList); // Here it is - any parameter list
end;

procedure TMyThread.Execute;
begin
.
Synchronize (MyMethod);
.
end;



lipskiy   (2002-03-20 20:50) [2]

Ahem ... This is understandable.
But here, in my case, everything looks something like this.
Execute executes fairly long, unbranched and non-looping code. Just a sequence of operations. Between these operations, I need to print the result on the main form. Naturally, these intermediate results occur only within Execute.
So what to do in this case?



Набережных С.   (2002-03-20 21:31) [3]

Dynamically allocate memory for the structure or variables and send the pointer through SendMessage, PostMessage or Synchronize.
Another option is a buffer with synchronization. There are other options, such as COM.



vuk   (2002-03-20 21:48) [4]

I don’t know who how, but I would go a completely different way. True, it turns out a little more complicated.
All parameters that a form needs to display the result are packed into a structure (record or object). Then a list (TThreadList) is created, which serves as a “buffer” and into which the thread adds the results of its work. Also, the stream has a Handle of the form to which it sends a message as soon as an item is added to the list. The form, having received the message, selects the elements from the list, displays them and then deletes them.



lipskiy   (2002-03-20 21:53) [5]

Damn, it's good to be smart ...
I don’t understand all this ... (for now)
Well, okay, thanks, and I'll figure it out.
Just my level below your suggestions.



Набережных С.   (2002-03-20 21:55) [6]


> vuk © (20.03.02 21: 48)

"Another way" - in what sense?
See > Another option is a buffer with synchronization




vuk   (2002-03-20 21:59) [7]

to Naberezhnye S .:
> "Another way" -in what sense?
I’m sorry, I overlooked. : o (
Well, nobody got worse from this. : o)



Набережных С.   (2002-03-20 22:05) [8]

I also apologize - I wrote in vain.



Pages: 1 whole branch

Forum: "Main";
Current archive: 2002.04.01;
Download: [xml.tar.bz2];

Top









Memory: 0.57 MB
Time: 0.021 c
We answer immediately.
Foxermoxer
2002-03-21 18:44
2002.04.01
URGENTLY!


We answer immediately.
Sound
2002-03-21 01:37
2002.04.01
Help with the TreeView component!


We answer immediately.
madburro
2002-02-15 22:47
2002.04.01
Optical mouse


We answer immediately.
Fellomena
2002-03-20 10:49
2002.04.01
Threads ... (inside)


We answer immediately.
Vlad__
2002-01-10 21:15
2002.04.01
Sockets





afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic indonesian Irish italian japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Español swahili Swedish thai turkish Ukrainian urdu vietnamese welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
zulu
English French German Italian Portuguese Russian Spanish